Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. ini_set('display_errors',1);
  2. ini_set('display_startup_errors',1);
  3. error_reporting(-1);
  4.  
  5. header('Content-Type','text/html; charset=WINDOWS-1250');
  6.  
  7. //$id = $_GET['ID'];
  8. //$ref = $_GET['Ref'];
  9. //$doc = $_GET['Doc'];
  10.  
  11. //$xURL = "/Smlouvy/Templates/" . $doc . ".asp?PDF=Yo&ID=" . $id . "&Ref=" . $ref;
  12.  
  13. // Include the main TCPDF library (search for installation path).
  14. require_once('../includes/tcpdf_min/tcpdf.php');
  15.  
  16. // create new PDF document
  17. //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'WINDOWS-1250', false);
  18. $pdf = new TCPDF('P', 'mm', 'A4', true);
  19.  
  20. $pdf->setPrintHeader(false);
  21.  
  22. // set document information
  23. //$pdf->SetCreator(PDF_CREATOR);
  24. //$pdf->SetAuthor('Nicola Asuni');
  25. //$pdf->SetTitle('TCPDF Example 006');
  26. //$pdf->SetSubject('TCPDF Tutorial');
  27. //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  28.  
  29. // set default header data
  30. //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
  31.  
  32. // set header and footer fonts
  33. //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  34. //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  35.  
  36. // set default monospaced font
  37. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  38.  
  39. // set margins
  40. //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  41. //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  42. //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  43.  
  44. // set auto page breaks
  45. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  46.  
  47. // set image scale factor
  48. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  49.  
  50. // set some language-dependent strings (optional)
  51. if (@file_exists(dirname(__FILE__).'/lang/ces.php')) {
  52. require_once(dirname(__FILE__).'/lang/ces.php');
  53. $pdf->setLanguageArray($l);
  54. }
  55.  
  56. // ---------------------------------------------------------
  57.  
  58. // set font
  59.  
  60. //$pdf->AddFont('times', '', 'times.php');
  61. $pdf->SetFont('freeserif', '', 10);
  62.  
  63. //$pdf->setHeaderFont(Array('dejavusans', '', 10, '', false));
  64. //$pdf->setFooterFont(Array('dejavusans', '', 8, '', false));
  65. //$pdf->SetFont('dejavusans', '', 10, '', false);
  66.  
  67. //$pdf->AddFont('verdana', '', 'verdana.php');
  68. //$pdf->SetFont('verdana', '', 10);
  69.  
  70. // add a page
  71. $pdf->AddPage();
  72.  
  73. // writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
  74. // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
  75.  
  76. // create some HTML content
  77. //$html = 'test <b>test</b>'; // TODO: natahnout stranku z intranetu
  78.  
  79.  
  80.  
  81.  
  82.  
  83. $input = file_get_contents('http://in01/intranet/Smlouvy/Templates/004_krnajem.asp?PDF=Yo&ID=1050&Ref=1');
  84. $html = iconv('WINDOWS-1250', 'UTF-8', str_replace('windows-1250', 'utf-8', $input));
  85. //echo (mb_detect_encoding($input, mb_detect_order()));
  86. //$fp = fopen('C:\inetpub\wwwroot\Intranet\includes\tcpdf_min\fonts\output1.html', 'w');
  87. //fwrite($fp, $html);
  88. //fclose($fp);
  89.  
  90.  
  91. // Specify configuration
  92. $config = array(
  93. 'indent' => true,
  94. 'output-xhtml' => true,
  95. 'wrap' => 200,
  96. 'word-2000' => true,
  97. 'show-body-only' => true);
  98.  
  99. // Tidy
  100. $tidy = new tidy;
  101. $tidy->parseString($html, $config, 'utf8');
  102. $tidy->cleanRepair();
  103.  
  104.  
  105.  
  106. //$html = 'zastoupené Ing. Milanem Janem Půčkem, MBA, Ph.D., generálním ředitelem';
  107.  
  108. //$html .= mb_detect_encoding($input, mb_detect_order());
  109.  
  110. //$html = iconv('UTF-8', 'UTF-8', "<html> <head></head> <body> <div class=Section1> <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial; color:black'>testzastoupen Ing. Milanem Janem Půčkem... enc: ".mb_detect_encoding($html2, mb_detect_order())."</span></p> </div> </body> </html>");
  111.  
  112. //$html = "<html> <head></head> <body> <div class=Section1> <p class=MsoNormal><span style='font-size:10.0pt;font-family:Arial; color:black'>testzastoupen Ing. Milanem Janem Půčkem...</span></p> </div> </body> </html>";
  113.  
  114.  
  115. echo($tidy);
  116. // $pdf->writeHTML($tidy, true, false, true, false, '');
  117.  
  118. // add a page
  119. //$pdf->AddPage();
  120.  
  121. //Close and output PDF document
  122. // $pdf->Output('output.pdf', 'I');
  123.  
  124. //============================================================+
  125. // END OF FILE
  126. //============================================================+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement