mirror of
https://github.com/vdm-io/tcpdf.git
synced 2024-11-29 23:53:54 +00:00
109 lines
3.4 KiB
PHP
109 lines
3.4 KiB
PHP
|
<?php
|
||
|
//============================================================+
|
||
|
// File name : example_051.php
|
||
|
// Begin : 2009-04-16
|
||
|
// Last Update : 2009-04-16
|
||
|
//
|
||
|
// Description : Example 051 for TCPDF class
|
||
|
// Full page background
|
||
|
//
|
||
|
// Author: Nicola Asuni
|
||
|
//
|
||
|
// (c) Copyright:
|
||
|
// Nicola Asuni
|
||
|
// Tecnick.com s.r.l.
|
||
|
// Via Della Pace, 11
|
||
|
// 09044 Quartucciu (CA)
|
||
|
// ITALY
|
||
|
// www.tecnick.com
|
||
|
// info@tecnick.com
|
||
|
//============================================================+
|
||
|
|
||
|
/**
|
||
|
* Creates an example PDF TEST document using TCPDF
|
||
|
* @package com.tecnick.tcpdf
|
||
|
* @abstract TCPDF - Example: Full page background
|
||
|
* @author Nicola Asuni
|
||
|
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||
|
* @link http://tcpdf.org
|
||
|
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||
|
* @since 2009-04-16
|
||
|
*/
|
||
|
|
||
|
require_once('../config/lang/eng.php');
|
||
|
require_once('../tcpdf.php');
|
||
|
|
||
|
|
||
|
// Extend the TCPDF class to create custom Header and Footer
|
||
|
class MYPDF extends TCPDF {
|
||
|
//Page header
|
||
|
public function Header() {
|
||
|
// Full background image
|
||
|
$auto_page_break = $this->AutoPageBreak;
|
||
|
$this->SetAutoPageBreak(false, 0);
|
||
|
$img_file = K_PATH_IMAGES.'image_demo.jpg';
|
||
|
$this->Image($img_file, $x=0, $y=0, $w=210, $h=297, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0);
|
||
|
$this->SetAutoPageBreak($auto_page_break);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// create new PDF document
|
||
|
$pdf = new MYPDF(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 051');
|
||
|
$pdf->SetSubject('TCPDF Tutorial');
|
||
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
||
|
|
||
|
// set header and footer fonts
|
||
|
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
||
|
|
||
|
// set default monospaced font
|
||
|
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
||
|
|
||
|
//set margins
|
||
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
||
|
$pdf->SetHeaderMargin(0);
|
||
|
$pdf->SetFooterMargin(0);
|
||
|
|
||
|
// remove default footer
|
||
|
$pdf->setPrintFooter(false);
|
||
|
|
||
|
//set auto page breaks
|
||
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
||
|
|
||
|
//set image scale factor
|
||
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||
|
|
||
|
//set some language-dependent strings
|
||
|
$pdf->setLanguageArray($l);
|
||
|
|
||
|
// ---------------------------------------------------------
|
||
|
|
||
|
// set font
|
||
|
$pdf->SetFont('times', '', 48);
|
||
|
|
||
|
// add a page
|
||
|
$pdf->AddPage();
|
||
|
|
||
|
// Pritn a text
|
||
|
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 1</span>', $ln=true, $fill=false, $reseth=false, $cell=false, $align='');
|
||
|
|
||
|
// add a page
|
||
|
$pdf->AddPage();
|
||
|
|
||
|
// Pritn a text
|
||
|
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 2</span>', $ln=true, $fill=false, $reseth=false, $cell=false, $align='');
|
||
|
|
||
|
// ---------------------------------------------------------
|
||
|
|
||
|
//Close and output PDF document
|
||
|
$pdf->Output('example_051.pdf', 'I');
|
||
|
|
||
|
//============================================================+
|
||
|
// END OF FILE
|
||
|
//============================================================+
|
||
|
?>
|