Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ini_set('display_errors',1);
- ini_set('display_startup_errors',1);
- error_reporting(-1);
- header('Content-Type','text/html; charset=WINDOWS-1250');
- //$id = $_GET['ID'];
- //$ref = $_GET['Ref'];
- //$doc = $_GET['Doc'];
- //$xURL = "/Smlouvy/Templates/" . $doc . ".asp?PDF=Yo&ID=" . $id . "&Ref=" . $ref;
- // Include the main TCPDF library (search for installation path).
- require_once('../includes/tcpdf_min/tcpdf.php');
- // create new PDF document
- //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'WINDOWS-1250', false);
- $pdf = new TCPDF('P', 'mm', 'A4', true);
- $pdf->setPrintHeader(false);
- // set document information
- //$pdf->SetCreator(PDF_CREATOR);
- //$pdf->SetAuthor('Nicola Asuni');
- //$pdf->SetTitle('TCPDF Example 006');
- //$pdf->SetSubject('TCPDF Tutorial');
- //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
- // set default header data
- //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
- // set header and footer fonts
- //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
- //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
- // set default monospaced font
- $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- // set margins
- //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
- //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
- //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
- // set auto page breaks
- $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
- // set image scale factor
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- // set some language-dependent strings (optional)
- if (@file_exists(dirname(__FILE__).'/lang/ces.php')) {
- require_once(dirname(__FILE__).'/lang/ces.php');
- $pdf->setLanguageArray($l);
- }
- // ---------------------------------------------------------
- // set font
- //$pdf->AddFont('times', '', 'times.php');
- $pdf->SetFont('freeserif', '', 10);
- //$pdf->setHeaderFont(Array('dejavusans', '', 10, '', false));
- //$pdf->setFooterFont(Array('dejavusans', '', 8, '', false));
- //$pdf->SetFont('dejavusans', '', 10, '', false);
- //$pdf->AddFont('verdana', '', 'verdana.php');
- //$pdf->SetFont('verdana', '', 10);
- // add a page
- $pdf->AddPage();
- // writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
- // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
- // create some HTML content
- //$html = 'test <b>test</b>'; // TODO: natahnout stranku z intranetu
- $input = file_get_contents('http://in01/intranet/Smlouvy/Templates/004_krnajem.asp?PDF=Yo&ID=1050&Ref=1');
- $html = iconv('WINDOWS-1250', 'UTF-8', str_replace('windows-1250', 'utf-8', $input));
- //echo (mb_detect_encoding($input, mb_detect_order()));
- //$fp = fopen('C:\inetpub\wwwroot\Intranet\includes\tcpdf_min\fonts\output1.html', 'w');
- //fwrite($fp, $html);
- //fclose($fp);
- // Specify configuration
- $config = array(
- 'indent' => true,
- 'output-xhtml' => true,
- 'wrap' => 200,
- 'word-2000' => true,
- 'show-body-only' => true);
- // Tidy
- $tidy = new tidy;
- $tidy->parseString($html, $config, 'utf8');
- $tidy->cleanRepair();
- //$html = 'zastoupené Ing. Milanem Janem Půčkem, MBA, Ph.D., generálním ředitelem';
- //$html .= mb_detect_encoding($input, mb_detect_order());
- //$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>");
- //$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>";
- echo($tidy);
- // $pdf->writeHTML($tidy, true, false, true, false, '');
- // add a page
- //$pdf->AddPage();
- //Close and output PDF document
- // $pdf->Output('output.pdf', 'I');
- //============================================================+
- // END OF FILE
- //============================================================+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement