Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have my website installed inside subdirectory.
I noticed that the function function invoice_view_pdf($invoice_number) (line 831 invoice.module ) produced error 500 after calling new DOMPDF() . I added the following line spl_autoload_register('DOMPDF_autoload'); and the problem solved ( See also at http://codeigniter.com/forums/viewthread/86724/ ). The final code is :
function invoice_view_pdf($invoice_number) {
// include the dompdf library
_invoice_dompdf_include_lib();
spl_autoload_register('DOMPDF_autoload'); // I dont' know what is doing this line but is solved my problem
$nid = db_result(db_query("SELECT nid FROM {invoice_invoices} WHERE iid=%d", $invoice_number));
$node = node_load($nid);
$html = _invoice_get_html($invoice_number, $node, 'pdf');
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream(t('invoice') .'-'. $node->invoice['formatted_invoice_number'] .".pdf", array('Attachment' => 1));
}
Comments
Comment #1
tinflute CreditAttribution: tinflute commentedBeautiful! I had the same problem and this line fixed it like a charm.
Perhaps consider submitting it as a patch eh.
Comment #2
pietervogelaar CreditAttribution: pietervogelaar commentedVersion 6 doesn't get updates anymore, so this is a nice solution for the problem.