source: sipes/libraries/tcpdf/examples/example_051.php @ b354002

stableversion-3.0
Last change on this file since b354002 was 307d09d, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agregaron las librerias

  • Propiedad mode establecida a 100755
File size: 3.2 KB
Línea 
1<?php
2//============================================================+
3// File name   : example_051.php
4// Begin       : 2009-04-16
5// Last Update : 2010-08-08
6//
7// Description : Example 051 for TCPDF class
8//               Full page background
9//
10// Author: Nicola Asuni
11//
12// (c) Copyright:
13//               Nicola Asuni
14//               Tecnick.com s.r.l.
15//               Via Della Pace, 11
16//               09044 Quartucciu (CA)
17//               ITALY
18//               www.tecnick.com
19//               info@tecnick.com
20//============================================================+
21
22/**
23 * Creates an example PDF TEST document using TCPDF
24 * @package com.tecnick.tcpdf
25 * @abstract TCPDF - Example: Full page background
26 * @author Nicola Asuni
27 * @since 2009-04-16
28 */
29
30require_once('../config/lang/eng.php');
31require_once('../tcpdf.php');
32
33
34// Extend the TCPDF class to create custom Header and Footer
35class MYPDF extends TCPDF {
36        //Page header
37        public function Header() {
38                // full background image
39                // store current auto-page-break status
40                $bMargin = $this->getBreakMargin();
41                $auto_page_break = $this->AutoPageBreak;
42                $this->SetAutoPageBreak(false, 0);
43                $img_file = K_PATH_IMAGES.'image_demo.jpg';
44                $this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
45                // restore auto-page-break status
46                $this->SetAutoPageBreak($auto_page_break, $bMargin);
47        }
48}
49
50// create new PDF document
51$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
52
53// set document information
54$pdf->SetCreator(PDF_CREATOR);
55$pdf->SetAuthor('Nicola Asuni');
56$pdf->SetTitle('TCPDF Example 051');
57$pdf->SetSubject('TCPDF Tutorial');
58$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
59
60// set header and footer fonts
61$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
62
63// set default monospaced font
64$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
65
66//set margins
67$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
68$pdf->SetHeaderMargin(0);
69$pdf->SetFooterMargin(0);
70
71// remove default footer
72$pdf->setPrintFooter(false);
73
74//set auto page breaks
75$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
76
77//set image scale factor
78$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
79
80//set some language-dependent strings
81$pdf->setLanguageArray($l);
82
83// ---------------------------------------------------------
84
85// set font
86$pdf->SetFont('times', '', 48);
87
88// add a page
89$pdf->AddPage();
90
91// Print a text
92$html = '<span style="background-color:yellow;color:blue;">&nbsp;PAGE 1&nbsp;</span>
93<p stroke="0.2" fill="true" strokecolor="yellow" color="blue" style="font-family:helvetica;font-weight:bold;font-size:26pt;">You can set a full page background.</p>';
94$pdf->writeHTML($html, true, false, true, false, '');
95
96
97// add a page
98$pdf->AddPage();
99
100// Print a text
101$html = '<span style="background-color:yellow;color:blue;">&nbsp;PAGE 2&nbsp;</span>';
102$pdf->writeHTML($html, true, false, true, false, '');
103
104// ---------------------------------------------------------
105
106//Close and output PDF document
107$pdf->Output('example_051.pdf', 'I');
108
109//============================================================+
110// END OF FILE                                               
111//============================================================+
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.