example_019.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. //============================================================+
  3. // File name : example_019.php
  4. // Begin : 2008-03-07
  5. // Last Update : 2010-08-08
  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 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: Non unicode with alternative config file
  25. * @author Nicola Asuni
  26. * @since 2008-03-04
  27. */
  28. require_once('../config/lang/eng.php');
  29. // load alternative config file
  30. require_once('../config/tcpdf_config_alt.php');
  31. define("K_TCPDF_EXTERNAL_CONFIG", true);
  32. require_once('../tcpdf.php');
  33. // create new PDF document
  34. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-8859-1', false);
  35. // Set document information dictionary in unicode mode
  36. $pdf->SetDocInfoUnicode(true);
  37. // set document information
  38. $pdf->SetCreator(PDF_CREATOR);
  39. $pdf->SetAuthor('Nicola Asuni [€]');
  40. $pdf->SetTitle('TCPDF Example 019');
  41. $pdf->SetSubject('TCPDF Tutorial');
  42. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  43. // set default header data
  44. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING);
  45. // set header and footer fonts
  46. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  47. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  48. // set default monospaced font
  49. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  50. //set margins
  51. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  52. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  53. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  54. //set auto page breaks
  55. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  56. //set image scale factor
  57. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  58. // set some language dependent data:
  59. $lg = Array();
  60. $lg['a_meta_charset'] = 'ISO-8859-1';
  61. $lg['a_meta_dir'] = 'ltr';
  62. $lg['a_meta_language'] = 'en';
  63. $lg['w_page'] = 'page';
  64. //set some language-dependent strings
  65. $pdf->setLanguageArray($lg);
  66. // ---------------------------------------------------------
  67. // set font
  68. $pdf->SetFont('helvetica', '', 12);
  69. // add a page
  70. $pdf->AddPage();
  71. // set color for background
  72. $pdf->SetFillColor(200, 255, 200);
  73. $txt = 'An alternative configuration file is used on this example.
  74. Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.';
  75. // print some text
  76. $pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
  77. // ---------------------------------------------------------
  78. //Close and output PDF document
  79. $pdf->Output('example_019.pdf', 'I');
  80. //============================================================+
  81. // END OF FILE
  82. //============================================================+