Esempio n. 1
0
<?php

require_once 'extension/instancecustomer/classes/tcpdf_min/tcpdf.php';
try {
    $instance = erLhcoreClassInstance::getInstance();
    $invoice = erLhcoreClassModelInstanceInvoice::fetch((int) $Params['user_parameters']['id']);
    if ($invoice->instance_id != $instance->id) {
        die('No permission to view');
    }
} catch (Exception $e) {
    print_r($e);
    exit;
}
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Remigijus Kiminas');
$pdf->SetTitle('Invoice');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)