Example #1
0
function printToServer($content, $name, $client, $folder_name, $version)
{
    //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->setVersion($version);
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Ignitor Labs');
    $pdf->setHeaderFont(false);
    $pdf->setPrintHeader(false);
    $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    // $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // 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)
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    // ---------------------------------------------------------
    // add a page
    $pdf->AddPage();
    // set font
    $pdf->SetFont('times', 'BI', 20, '', 'false');
    //$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0);
    // create some HTML content
    $html = $content;
    // set core font
    $pdf->SetFont('helvetica', '', 10);
    // output the HTML content
    $pdf->writeHTML($html, true, 0, true, true);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('assets/contracts/' . $folder_name . '/' . $client . '_' . $name . '.pdf', 'F');
}
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font
        $this->SetFont('helvetica', 'I', 8);
        // Page number
        $this->Cell(60, 10, $this->date, 0, false, 'L', 0, '', 0, false, 'T', 'M');
        $this->Cell(60, 10, 'V ' . $this->version, 0, false, 'C', 0, '', 0, false, 'T', 'M');
        $this->Cell(60, 10, 'Page ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
    }
}
$db = new MysqliDb();
$db->where('id', $_GET['id']);
$history = $db->getOne('history');
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setVersion((string) $_GET['version'] . ".0");
$pdf->setDate($_GET['date']);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Ignitor Labs');
$pdf->setHeaderFont(false);
$pdf->setPrintHeader(false);
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor