example_002.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. //============================================================+
  3. // File name : example_002.php
  4. // Begin : 2008-03-04
  5. // Last Update : 2010-08-08
  6. //
  7. // Description : Example 002 for TCPDF class
  8. // Removing Header and Footer
  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. * Creates an example PDF TEST document using TCPDF
  23. * @package com.tecnick.tcpdf
  24. * @abstract TCPDF - Example: Removing Header and Footer
  25. * @author Nicola Asuni
  26. * @since 2008-03-04
  27. */
  28. require_once('../config/lang/eng.php');
  29. require_once('../tcpdf.php');
  30. // create new PDF document
  31. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  32. // set document information
  33. $pdf->SetCreator(PDF_CREATOR);
  34. $pdf->SetAuthor('Nicola Asuni');
  35. $pdf->SetTitle('TCPDF Example 002');
  36. $pdf->SetSubject('TCPDF Tutorial');
  37. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  38. // remove default header/footer
  39. $pdf->setPrintHeader(false);
  40. $pdf->setPrintFooter(false);
  41. // set default monospaced font
  42. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  43. //set margins
  44. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  45. //set auto page breaks
  46. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  47. //set image scale factor
  48. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  49. //set some language-dependent strings
  50. $pdf->setLanguageArray($l);
  51. // ---------------------------------------------------------
  52. // set font
  53. $pdf->SetFont('times', 'BI', 20);
  54. // add a page
  55. $pdf->AddPage();
  56. // set some text to print
  57. $txt = <<<EOD
  58. TCPDF Example 002
  59. Default page header and footer are disabled using setPrintHeader() and setPrintFooter() methods.
  60. EOD;
  61. // print a block of text using Write()
  62. $pdf->Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);
  63. // ---------------------------------------------------------
  64. //Close and output PDF document
  65. $pdf->Output('example_002.pdf', 'I');
  66. //============================================================+
  67. // END OF FILE
  68. //============================================================+