Commit 74b317f858641461289bcc0eafae71ddef37e347
1 parent
151c5c54bf
Exists in
master
renamed: fpdfdemo -> fpdf_demo
Showing 2 changed files with 77 additions and 77 deletions Inline Diff
fpdf_demo
View file @
74b317f
File was created | 1 | #!/usr/bin/env php | ||
2 | ||||
3 | <?php | |||
4 | /** | |||
5 | * FILENAME: | |||
6 | * fpdfdemo | |||
7 | * | |||
8 | * DESCRIPTION: | |||
9 | * Demonstration of the FPDF PHP Library for generating PDF files | |||
10 | * | |||
11 | */ | |||
12 | ||||
13 | /** | |||
14 | * Links: | |||
15 | * - https://packagist.org/packages/itbz/fpdf | |||
16 | * - http://www.fpdf.org/ | |||
17 | * - http://www.fpdf.org/en/doc/index.php | |||
18 | * - http://www.fpdf.org/en/tutorial/index.php | |||
19 | * - http://www.fpdf.org/en/tutorial/tuto6.htm (Links and flowing text) | |||
20 | * - http://www.fpdf.org/en/script/index.php | |||
21 | * | |||
22 | * This script also requires FPDI to load PDF documents into memory | |||
23 | * - https://www.setasign.com/products/fpdi/about/ | |||
24 | * - https://www.setasign.com/products/fpdi/manual/#p-200 | |||
25 | * | |||
26 | * NOTE the line 'use fpdf\FPDF as FPDF;' needs to be added to the FPDI | |||
27 | * library, specifically in vendor/setasign/fpdi/fpdi_bridge.php, line 19, | |||
28 | * for FPDI to work | |||
29 | */ | |||
30 | ||||
31 | $loader = require __DIR__ . '/vendor/autoload.php'; | |||
32 | $loader->register(); | |||
33 | ||||
34 | $pdf = new FPDI('p', 'mm', 'Letter'); | |||
35 | ||||
36 | // write out the contents of the first page | |||
37 | $pdf->AddPage(); | |||
38 | $topLink = $pdf->AddLink(); | |||
39 | $pdf->SetLink($topLink); | |||
40 | $pdf->SetFont('Arial', '', 20); | |||
41 | $pdf->SetFont('', 'U'); | |||
42 | $ssfLink = $pdf->AddLink(); | |||
43 | $pdf->Write(10, "Jump SSF for SHACK-10A", $ssfLink); | |||
44 | $pdf->SetFont(''); | |||
45 | $pdf->Ln(); | |||
46 | $pdf->Write(10, "This is some text on the first page; "); | |||
47 | $pdf->Ln(); | |||
48 | $pdf->Write(10, "Привет! Этот немного текста."); | |||
49 | ||||
50 | // load up the Site Summary Figure to go on page #2 | |||
51 | $ssfPageCount = $pdf->setSourceFile(__DIR__ . '/site_summary_figure.pdf'); | |||
52 | ||||
53 | print "Page count of site summary figure form is $ssfPageCount\n"; | |||
54 | ||||
55 | // import the SSF page | |||
56 | $ssfTemplate= $pdf->importPage(1); | |||
57 | print "Page size of site summary figure PDF is: "; | |||
58 | $ssfSize = $pdf->getTemplateSize($ssfTemplate); | |||
59 | print "{$ssfSize['w']} x {$ssfSize['h']}\n"; | |||
60 | ||||
61 | // add the SSF file to the 2nd page | |||
62 | $pdf->AddPage(); | |||
63 | $pdf->SetLink($ssfLink); | |||
64 | $pdf->useTemplate($ssfTemplate); | |||
65 | $pdf->SetFont('Helvetica'); | |||
66 | $pdf->SetXY(5,5); |
fpdfdemo
View file @
74b317f
#!/usr/bin/env php | 1 | File was deleted | ||
2 | ||||
<?php | 3 | |||
/** | 4 | |||
* FILENAME: | 5 | |||
* fpdfdemo | 6 | |||
* | 7 | |||
* DESCRIPTION: | 8 | |||
* Demonstration of the FPDF PHP Library for generating PDF files | 9 | |||
* | 10 | |||
*/ | 11 | |||
12 | ||||
/** | 13 | |||
* Links: | 14 | |||
* - https://packagist.org/packages/itbz/fpdf | 15 | |||
* - http://www.fpdf.org/ | 16 | |||
* - http://www.fpdf.org/en/doc/index.php | 17 | |||
* - http://www.fpdf.org/en/tutorial/index.php | 18 | |||
* - http://www.fpdf.org/en/tutorial/tuto6.htm (Links and flowing text) | 19 | |||
* - http://www.fpdf.org/en/script/index.php | 20 | |||
* | 21 | |||
* This script also requires FPDI to load PDF documents into memory | 22 | |||
* - https://www.setasign.com/products/fpdi/about/ | 23 | |||
* - https://www.setasign.com/products/fpdi/manual/#p-200 | 24 | |||
* | 25 | |||
* NOTE the line 'use fpdf\FPDF as FPDF;' needs to be added to the FPDI | 26 | |||
* library, specifically in vendor/setasign/fpdi/fpdi_bridge.php, line 19, | 27 | |||
* for FPDI to work | 28 | |||
*/ | 29 | |||
30 | ||||
$loader = require __DIR__ . '/vendor/autoload.php'; | 31 | |||
$loader->register(); | 32 | |||
33 | ||||
$pdf = new FPDI('p', 'mm', 'Letter'); | 34 | |||
35 | ||||
// write out the contents of the first page | 36 | |||
$pdf->AddPage(); | 37 | |||
$topLink = $pdf->AddLink(); | 38 | |||
$pdf->SetLink($topLink); | 39 | |||
$pdf->SetFont('Arial', '', 20); | 40 | |||
$pdf->SetFont('', 'U'); | 41 | |||
$ssfLink = $pdf->AddLink(); | 42 | |||
$pdf->Write(10, "Jump SSF for SHACK-10A", $ssfLink); | 43 | |||
$pdf->SetFont(''); | 44 | |||
$pdf->Ln(); | 45 | |||
$pdf->Write(10, "This is some text on the first page; "); | 46 | |||
$pdf->Ln(); | 47 | |||
$pdf->Write(10, "Привет! Этот немного текста."); | 48 | |||
49 | ||||
// load up the Site Summary Figure to go on page #2 | 50 | |||
$ssfPageCount = $pdf->setSourceFile(__DIR__ . '/site_summary_figure.pdf'); | 51 | |||
52 | ||||
print "Page count of site summary figure form is $ssfPageCount\n"; | 53 | |||
54 | ||||
// import the SSF page | 55 | |||
$ssfTemplate= $pdf->importPage(1); | 56 | |||
print "Page size of site summary figure PDF is: "; | 57 | |||
$ssfSize = $pdf->getTemplateSize($ssfTemplate); | 58 | |||
print "{$ssfSize['w']} x {$ssfSize['h']}\n"; | 59 | |||
60 | ||||
// add the SSF file to the 2nd page | 61 | |||
$pdf->AddPage(); | 62 | |||
$pdf->SetLink($ssfLink); | 63 | |||
$pdf->useTemplate($ssfTemplate); | 64 | |||
$pdf->SetFont('Helvetica'); | 65 | |||
$pdf->SetXY(5,5); | 66 |