testutf.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. // This source file must be UTF-8 encoded
  3. /*
  4. $filename='filewithé';
  5. print 'Test to create a file on disk with name '.$filename."<br>\n";
  6. print 'ENV[LANG]='.$_ENV["LANG"]."<br>\n";
  7. print 'ENV[LANGUAGE]='.$_ENV["LANGUAGE"]."<br>\n";
  8. // Si LANG contient UTF8, system en UTF8, pas de conversion requise pour fopen
  9. $s=fopen('/tmp/'.$filename,'w');
  10. fclose($s);
  11. print 'Files has been created. Check its name from your explorer'."\n";
  12. <?php
  13. */
  14. //============================================================+
  15. // File name : example_038.php
  16. // Begin : 2008-09-15
  17. // Last Update : 2010-08-08
  18. //
  19. // Description : Example 038 for TCPDF class
  20. // CID-0 CJK unembedded font
  21. //
  22. // Author: Nicola Asuni
  23. //
  24. // (c) Copyright:
  25. // Nicola Asuni
  26. // Tecnick.com s.r.l.
  27. // Via Della Pace, 11
  28. // 09044 Quartucciu (CA)
  29. // ITALY
  30. // www.tecnick.com
  31. // info@tecnick.com
  32. //============================================================+
  33. /**
  34. * Creates an example PDF TEST document using TCPDF
  35. * @package com.tecnick.tcpdf
  36. * @abstract TCPDF - Example: CID-0 CJK unembedded font
  37. * @author Nicola Asuni
  38. * @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
  39. * @link http://tcpdf.org
  40. * @license https://www.gnu.org/copyleft/lesser.html LGPL
  41. * @since 2008-09-15
  42. */
  43. require_once '../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php';
  44. require_once '../../htdocs/includes/tecnickcom/tcpdf/tcpdf.php';
  45. // create new PDF document
  46. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  47. // set document information
  48. $pdf->SetCreator(PDF_CREATOR);
  49. $pdf->SetAuthor('Nicola Asuni');
  50. $pdf->SetTitle('TCPDF Example 038');
  51. $pdf->SetSubject('TCPDF Tutorial');
  52. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  53. // set default header data
  54. $pdf->SetHeaderData('', PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 038', PDF_HEADER_STRING);
  55. // set header and footer fonts
  56. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  57. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  58. // set default monospaced font
  59. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  60. //set margins
  61. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  62. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  63. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  64. //set auto page breaks
  65. $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
  66. //set image scale factor
  67. //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  68. //set some language-dependent strings
  69. $pdf->setLanguageArray($l);
  70. // ---------------------------------------------------------
  71. // set font
  72. $pdf->SetFont('arialunicid0', '', 20);
  73. // add a page
  74. $pdf->AddPage();
  75. $txt = 'Example of CID-0 CJK unembedded font.
  76. To display extended text you must have CJK fonts for your PDF reader: こんにちは世界';
  77. $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
  78. // ---------------------------------------------------------
  79. //Close and output PDF document
  80. $pdf->Output('example.pdf', 'F');
  81. //============================================================+
  82. // END OF FILE
  83. //============================================================+