#!/usr/bin/env php <?php /** * FILENAME: * pdflib_demo * * DESCRIPTION: * Demonstration of the pdflib PHP Library for generating PDF files * */ /** Links: - https://www.pdflib.com/developer/technical-documentation/manuals/ - https://www.pdflib.com/pdflib-cookbook/browse-all-topics/ PDFlib was loaded via a Homebrew package for working with this demo */ $loader = require __DIR__ . '/vendor/autoload.php'; $loader->register(); // set a default timezone date_default_timezone_set("America/Los_Angeles"); //require_once('tcpdf_include.php'); //$pdf = new TCPDF('p', 'mm', 'Letter', TRUE, 'UTF-8'); class_exists('TCPDF', true); $pdf = new FPDI('p', 'mm', 'Letter', TRUE, 'UTF-8'); // disable headers and footers on all pages $pdf->setPrintHeader(FALSE); $pdf->setPrintFooter(FALSE); // write out the contents of the first page $pdf->AddPage(); $topLink = $pdf->AddLink(); $pdf->SetLink($topLink); //$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); $pdf->AddFont('dejavusanscondensed','','dejavusanscondensed.php',true); //$pdf->SetFont('DejaVu', '', 20); $pdf->SetFont('dejavusanscondensed', '', 20); $pdf->SetFont('', 'U'); $ssfLink = $pdf->AddLink(); $pdf->Write(10, "Jump to SSF for SHACK-10A", $ssfLink); $pdf->SetFont(''); $pdf->Ln(); $pdf->Write(10, "This is some text on the first page; "); $pdf->Ln(); $pdf->Write(10, "Привет! Ðтот немного текÑта."); // load up the Site Summary Figure to go on page #2 $ssfPageCount = $pdf->setSourceFile(__DIR__ . '/site_summary_figure.pdf'); //print "Page count of site summary figure form is $ssfPageCount\n"; // import the SSF page $ssfTemplate= $pdf->importPage(1); //print "Page size of site summary figure PDF is: "; //$ssfSize = $pdf->getTemplateSize($ssfTemplate); //print "{$ssfSize['w']}mm x {$ssfSize['h']}mm\n"; // add the SSF file to the 2nd page $pdf->AddPage(); $pdf->SetLink($ssfLink); $pdf->useTemplate($ssfTemplate); $pdf->SetFont('Helvetica'); $pdf->SetXY(5,5); $pdf->SetFont('', 'U'); $pdf->Write(8, "Top", $topLink); $pdf->SetFont(''); $pdf->SetXY(40, 5); $pdf->Write(8, " SSF: P771/SHACK-10A"); // destination, F = "local file"; filename; isUTF8 (boolean) //$pdf->Output('F', 'output.pdf', TRUE); $pdf->Output(__DIR__ . '/output.pdf', 'F'); // vim: expandtab filetype=php shiftwidth=3 tabstop=3