From 840f46a6049c1d3397f72daf4b0090b371385d9e Mon Sep 17 00:00:00 2001 From: Brian Manning Date: Wed, 20 Apr 2016 14:57:48 -0700 Subject: [PATCH] tcpdf_demo: script generates a valid PDF output file (with header lines) --- tcpdf_demo | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tcpdf_demo b/tcpdf_demo index aa764d0..01f2dfc 100755 --- a/tcpdf_demo +++ b/tcpdf_demo @@ -31,17 +31,25 @@ $loader = require __DIR__ . '/vendor/autoload.php'; $loader->register(); -$pdf = new FPDI('p', 'mm', 'Letter'); +// 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'); // write out the contents of the first page $pdf->AddPage(); $topLink = $pdf->AddLink(); $pdf->SetLink($topLink); -$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); -$pdf->SetFont('DejaVu', '', 20); +//$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 SSF for SHACK-10A", $ssfLink); +$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; "); @@ -50,14 +58,13 @@ $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"; +//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']} x {$ssfSize['h']}\n"; +//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(); @@ -73,6 +80,6 @@ $pdf->Write(8, " SSF: P771/SHACK-10A"); // destination, F = "local file"; filename; isUTF8 (boolean) //$pdf->Output('F', 'output.pdf', TRUE); -$pdf->Output('output.pdf', 'F'); +$pdf->Output(__DIR__ . '/output.pdf', 'F'); // vim: expandtab filetype=php shiftwidth=3 tabstop=3 -- 1.9.1