2010-05-05 09:56:52 +00:00
|
|
|
<?php
|
|
|
|
//============================================================+
|
|
|
|
// File name : example_058.php
|
|
|
|
// Begin : 2010-04-22
|
2013-05-14 20:28:42 +00:00
|
|
|
// Last Update : 2013-05-14
|
2010-05-05 09:56:52 +00:00
|
|
|
//
|
|
|
|
// Description : Example 058 for TCPDF class
|
|
|
|
// SVG Image
|
|
|
|
//
|
|
|
|
// Author: Nicola Asuni
|
|
|
|
//
|
|
|
|
// (c) Copyright:
|
|
|
|
// Nicola Asuni
|
2011-12-23 17:19:43 +00:00
|
|
|
// Tecnick.com LTD
|
2010-05-05 09:56:52 +00:00
|
|
|
// www.tecnick.com
|
|
|
|
// info@tecnick.com
|
|
|
|
//============================================================+
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an example PDF TEST document using TCPDF
|
|
|
|
* @package com.tecnick.tcpdf
|
|
|
|
* @abstract TCPDF - Example: SVG Image
|
|
|
|
* @author Nicola Asuni
|
|
|
|
* @since 2010-05-02
|
|
|
|
*/
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
// Include the main TCPDF library (search for installation path).
|
|
|
|
require_once('tcpdf_include.php');
|
2010-05-05 09:56:52 +00:00
|
|
|
|
|
|
|
// create new PDF document
|
|
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
|
|
|
|
|
// set document information
|
|
|
|
$pdf->SetCreator(PDF_CREATOR);
|
|
|
|
$pdf->SetAuthor('Nicola Asuni');
|
|
|
|
$pdf->SetTitle('TCPDF Example 058');
|
|
|
|
$pdf->SetSubject('TCPDF Tutorial');
|
|
|
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
|
|
|
|
|
|
|
// set default header data
|
2010-05-21 16:47:01 +00:00
|
|
|
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING);
|
2010-05-05 09:56:52 +00:00
|
|
|
|
|
|
|
// set header and footer fonts
|
|
|
|
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
|
|
|
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
|
|
|
|
|
|
|
|
// set default monospaced font
|
|
|
|
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
// set margins
|
2010-05-05 09:56:52 +00:00
|
|
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
|
|
|
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
|
|
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
// set auto page breaks
|
2010-05-05 09:56:52 +00:00
|
|
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
// set image scale factor
|
2010-05-05 09:56:52 +00:00
|
|
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
// set some language-dependent strings (optional)
|
|
|
|
if (file_exists(dirname(__FILE__).'/lang/eng.php')) {
|
|
|
|
require_once(dirname(__FILE__).'/lang/eng.php');
|
|
|
|
$pdf->setLanguageArray($l);
|
|
|
|
}
|
2010-05-05 09:56:52 +00:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
// set font
|
|
|
|
$pdf->SetFont('helvetica', '', 10);
|
|
|
|
|
|
|
|
// add a page
|
|
|
|
$pdf->AddPage();
|
|
|
|
|
|
|
|
// NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library.
|
|
|
|
//$pdf->setRasterizeVectorImages(true);
|
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
$pdf->ImageSVG($file='images/testsvg.svg', $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false);
|
2010-05-05 09:56:52 +00:00
|
|
|
|
2013-05-14 20:28:42 +00:00
|
|
|
$pdf->ImageSVG($file='images/tux.svg', $x=30, $y=100, $w='', $h=100, $link='', $align='', $palign='', $border=0, $fitonpage=false);
|
2010-05-21 16:47:01 +00:00
|
|
|
|
|
|
|
$pdf->SetFont('helvetica', '', 8);
|
|
|
|
$pdf->SetY(195);
|
|
|
|
$txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.';
|
|
|
|
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
|
|
|
|
|
2010-05-05 09:56:52 +00:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
//Close and output PDF document
|
2013-05-14 20:28:42 +00:00
|
|
|
$pdf->Output('example_058.pdf', 'D');
|
2010-05-05 09:56:52 +00:00
|
|
|
|
|
|
|
//============================================================+
|
|
|
|
// END OF FILE
|
|
|
|
//============================================================+
|