Commit 840f46a6049c1d3397f72daf4b0090b371385d9e
1 parent
fdcecf240a
Exists in
master
tcpdf_demo: script generates a valid PDF output file (with header lines)
Showing 1 changed file with 17 additions and 10 deletions Side-by-side Diff
tcpdf_demo
View file @
840f46a
... | ... | @@ -31,17 +31,25 @@ |
31 | 31 | $loader = require __DIR__ . '/vendor/autoload.php'; |
32 | 32 | $loader->register(); |
33 | 33 | |
34 | -$pdf = new FPDI('p', 'mm', 'Letter'); | |
34 | +// set a default timezone | |
35 | +date_default_timezone_set("America/Los_Angeles"); | |
35 | 36 | |
37 | +//require_once('tcpdf_include.php'); | |
38 | +//$pdf = new TCPDF('p', 'mm', 'Letter', TRUE, 'UTF-8'); | |
39 | +class_exists('TCPDF', true); | |
40 | +$pdf = new FPDI('p', 'mm', 'Letter', TRUE, 'UTF-8'); | |
41 | + | |
36 | 42 | // write out the contents of the first page |
37 | 43 | $pdf->AddPage(); |
38 | 44 | $topLink = $pdf->AddLink(); |
39 | 45 | $pdf->SetLink($topLink); |
40 | -$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); | |
41 | -$pdf->SetFont('DejaVu', '', 20); | |
46 | +//$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); | |
47 | +$pdf->AddFont('dejavusanscondensed','','dejavusanscondensed.php',true); | |
48 | +//$pdf->SetFont('DejaVu', '', 20); | |
49 | +$pdf->SetFont('dejavusanscondensed', '', 20); | |
42 | 50 | $pdf->SetFont('', 'U'); |
43 | 51 | $ssfLink = $pdf->AddLink(); |
44 | -$pdf->Write(10, "Jump SSF for SHACK-10A", $ssfLink); | |
52 | +$pdf->Write(10, "Jump to SSF for SHACK-10A", $ssfLink); | |
45 | 53 | $pdf->SetFont(''); |
46 | 54 | $pdf->Ln(); |
47 | 55 | $pdf->Write(10, "This is some text on the first page; "); |
48 | 56 | |
49 | 57 | |
... | ... | @@ -50,14 +58,13 @@ |
50 | 58 | |
51 | 59 | // load up the Site Summary Figure to go on page #2 |
52 | 60 | $ssfPageCount = $pdf->setSourceFile(__DIR__ . '/site_summary_figure.pdf'); |
61 | +//print "Page count of site summary figure form is $ssfPageCount\n"; | |
53 | 62 | |
54 | -print "Page count of site summary figure form is $ssfPageCount\n"; | |
55 | - | |
56 | 63 | // import the SSF page |
57 | 64 | $ssfTemplate= $pdf->importPage(1); |
58 | -print "Page size of site summary figure PDF is: "; | |
59 | -$ssfSize = $pdf->getTemplateSize($ssfTemplate); | |
60 | -print "{$ssfSize['w']} x {$ssfSize['h']}\n"; | |
65 | +//print "Page size of site summary figure PDF is: "; | |
66 | +//$ssfSize = $pdf->getTemplateSize($ssfTemplate); | |
67 | +//print "{$ssfSize['w']}mm x {$ssfSize['h']}mm\n"; | |
61 | 68 | |
62 | 69 | // add the SSF file to the 2nd page |
63 | 70 | $pdf->AddPage(); |
... | ... | @@ -73,7 +80,7 @@ |
73 | 80 | |
74 | 81 | // destination, F = "local file"; filename; isUTF8 (boolean) |
75 | 82 | //$pdf->Output('F', 'output.pdf', TRUE); |
76 | -$pdf->Output('output.pdf', 'F'); | |
83 | +$pdf->Output(__DIR__ . '/output.pdf', 'F'); | |
77 | 84 | |
78 | 85 | // vim: expandtab filetype=php shiftwidth=3 tabstop=3 |