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.

98 lines
2.9 KiB

4 years ago
  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. /**
  19. * Creates an example PDF TEST document using TCPDF
  20. * @package com.tecnick.tcpdf
  21. * @abstract TCPDF - Example: Non unicode with alternative config file
  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, false, 'ISO-8859-1', false);
  29. // Set document information dictionary in unicode mode
  30. $pdf->SetDocInfoUnicode(true);
  31. // set document information
  32. $pdf->SetCreator(PDF_CREATOR);
  33. $pdf->SetAuthor('Nicola Asuni [€]');
  34. $pdf->SetTitle('TCPDF Example 019');
  35. $pdf->SetSubject('TCPDF Tutorial');
  36. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  37. // set default header data
  38. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING);
  39. // set header and footer fonts
  40. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  41. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  42. // set default monospaced font
  43. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  44. // set margins
  45. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  46. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  47. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  48. // set auto page breaks
  49. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  50. // set image scale factor
  51. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  52. // set some language dependent data:
  53. $lg = Array();
  54. $lg['a_meta_charset'] = 'ISO-8859-1';
  55. $lg['a_meta_dir'] = 'ltr';
  56. $lg['a_meta_language'] = 'en';
  57. $lg['w_page'] = 'page';
  58. // set some language-dependent strings (optional)
  59. $pdf->setLanguageArray($lg);
  60. // ---------------------------------------------------------
  61. // set font
  62. $pdf->SetFont('helvetica', '', 12);
  63. // add a page
  64. $pdf->AddPage();
  65. // set color for background
  66. $pdf->SetFillColor(200, 255, 200);
  67. $txt = 'An alternative configuration file is used on this example.
  68. Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.';
  69. // print some text
  70. $pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
  71. // ---------------------------------------------------------
  72. //Close and output PDF document
  73. $pdf->Output('example_019.pdf', 'I');
  74. //============================================================+
  75. // END OF FILE
  76. //============================================================+