ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
example_019.php
Go to the documentation of this file.
1<?php
2//============================================================+
3// File name : example_019.php
4// Begin : 2008-03-07
5// Last Update : 2013-05-14
6//
7// Description : Example 019 for TCPDF class
8// Non unicode with alternative config file
9//
10// Author: Nicola Asuni
11//
12// (c) Copyright:
13// Nicola Asuni
14// Tecnick.com LTD
15// www.tecnick.com
16// info@tecnick.com
17//============================================================+
18
27// Include the main TCPDF library (search for installation path).
28require_once('tcpdf_include.php');
29
30// create new PDF document
31$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-8859-1', false);
32
33// Set document information dictionary in unicode mode
34$pdf->SetDocInfoUnicode(true);
35
36// set document information
37$pdf->SetCreator(PDF_CREATOR);
38$pdf->SetAuthor('Nicola Asuni [€]');
39$pdf->SetTitle('TCPDF Example 019');
40$pdf->SetSubject('TCPDF Tutorial');
41$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
42
43// set default header data
45
46// set header and footer fonts
47$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
48$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
49
50// set default monospaced font
51$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
52
53// set margins
55$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
56$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
57
58// set auto page breaks
59$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
60
61// set image scale factor
62$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
63
64// set some language dependent data:
65$lg = Array();
66$lg['a_meta_charset'] = 'ISO-8859-1';
67$lg['a_meta_dir'] = 'ltr';
68$lg['a_meta_language'] = 'en';
69$lg['w_page'] = 'page';
70
71// set some language-dependent strings (optional)
72$pdf->setLanguageArray($lg);
73
74// ---------------------------------------------------------
75
76// set font
77$pdf->SetFont('helvetica', '', 12);
78
79// add a page
80$pdf->AddPage();
81
82// set color for background
83$pdf->SetFillColor(200, 255, 200);
84
85$txt = 'An alternative configuration file is used on this example.
86Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.';
87
88// print some text
89$pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
90
91// ---------------------------------------------------------
92
93//Close and output PDF document
94$pdf->Output('example_019.pdf', 'I');
95
96//============================================================+
97// END OF FILE
98//============================================================+
PHP class for generating PDF documents without requiring external extensions.
Definition: tcpdf.php:134
$pdf
Definition: example_019.php:31
$txt
Definition: example_019.php:85
$lg
Definition: example_019.php:65
const PDF_FONT_NAME_MAIN
Default main font name.
const PDF_MARGIN_FOOTER
Footer margin.
const PDF_MARGIN_RIGHT
Right margin.
const PDF_PAGE_FORMAT
Page format.
const PDF_HEADER_STRING
Header description string.
const PDF_HEADER_TITLE
Header title.
const PDF_MARGIN_HEADER
Header margin.
const PDF_CREATOR
Document creator.
const PDF_MARGIN_BOTTOM
Bottom margin.
const PDF_FONT_MONOSPACED
Default monospaced font name.
const PDF_MARGIN_TOP
Top margin.
const PDF_FONT_NAME_DATA
Default data font name.
const PDF_FONT_SIZE_DATA
Default data font size.
const PDF_PAGE_ORIENTATION
Page orientation (P=portrait, L=landscape).
const PDF_UNIT
Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
const PDF_MARGIN_LEFT
Left margin.
const PDF_FONT_SIZE_MAIN
Default main font size.
const PDF_IMAGE_SCALE_RATIO
Ratio used to adjust the conversion of pixels to user units.
const PDF_HEADER_LOGO_WIDTH
Header logo image width in user units.
const PDF_HEADER_LOGO
Deafult image logo used be the default Header() method.