示例#1
0
function web_invoice_pdf_file($invoice_id)
{
    $dompdf = web_invoice_pdf_get($invoice_id);
    $tmpfname = tempnam(sys_get_temp_dir(), "web_invoice_") . ".pdf";
    $handle = file_put_contents($tmpfname, $dompdf->output());
    return $tmpfname;
}
示例#2
0
function web_invoice_print_pdf()
{
    $ip = $_SERVER['REMOTE_ADDR'];
    // Check to see a proper invoice id is used, or show regular content
    if (!($invoice_id = web_invoice_md5_to_invoice($_GET['invoice_id']))) {
        return $content;
    }
    // Invoice viewed, update log
    web_invoice_update_log($invoice_id, 'visited', "PDF downloaded by {$ip}");
    $dompdf = web_invoice_pdf_get($invoice_id);
    $dompdf->stream("web-invoice-{$invoice_id}.pdf");
    exit(0);
}