You are here

function invoice_view_pdf in Invoice 6

Same name and namespace in other branches
  1. 7 invoice.module \invoice_view_pdf()

Display the invoice in PDF format

1 string reference to 'invoice_view_pdf'
invoice_menu in ./invoice.module
Implementation of hook_menu()

File

./invoice.module, line 839
Invoice module

Code

function invoice_view_pdf($invoice_number) {

  // include the dompdf library
  _invoice_dompdf_include_lib();
  $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,
  ));
  die;
}