You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.3 KiB

  1. <?php
  2. //============================================================+
  3. // File name : example_002.php
  4. // Begin : 2008-03-04
  5. // Last Update : 2013-05-14
  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 LTD
  15. // www.tecnick.com
  16. // info@tecnick.com
  17. //============================================================+
  18. /**
  19. * Creates an example PDF TEST document using TCPDF
  20. * @package com.tecnick.tcpdf
  21. * @abstract TCPDF - Example: Removing Header and Footer
  22. * @author Nicola Asuni
  23. * @since 2008-03-04
  24. */
  25. // Include the main TCPDF library (search for installation path).
  26. require_once('tcpdf_include.php');
  27. // create new PDF document
  28. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  29. // set document information
  30. $pdf->SetCreator(PDF_CREATOR);
  31. $pdf->SetAuthor('Nicola Asuni');
  32. $pdf->SetTitle('TCPDF Example 002');
  33. $pdf->SetSubject('TCPDF Tutorial');
  34. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  35. // remove default header/footer
  36. $pdf->setPrintHeader(false);
  37. $pdf->setPrintFooter(false);
  38. // set default monospaced font
  39. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  40. // set margins
  41. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  42. // set auto page breaks
  43. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  44. // set image scale factor
  45. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  46. // set some language-dependent strings (optional)
  47. if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
  48. require_once(dirname(__FILE__).'/lang/eng.php');
  49. $pdf->setLanguageArray($l);
  50. }
  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(0, $txt, '', 0, 'C', true, 0, false, false, 0);
  63. // ---------------------------------------------------------
  64. //Close and output PDF document
  65. $pdf->Output('example_002.pdf', 'I');
  66. //============================================================+
  67. // END OF FILE
  68. //============================================================+