tcpdf

how TCPDF prevent the extra blank page

孤者浪人 提交于 2019-11-26 21:55:35
问题 I have create class to make page by using TCPDF. I need to convert HTML to pdf, so I using writeHTML and AcceptPageBreak() . The $html is Dynamically changed, could be very long. class MY_TCPDF extends TCPDF{ public function makePage($html){ $head_image="header.jpg"; $this->SetMargins(PDF_MARGIN_LEFT, 70, PDF_MARGIN_RIGHT); $this->setPrintHeader(false); $this->AddPage(); // get the current page break margin $bMargin = $this->getBreakMargin(); // get current auto-page-break mode $auto_page

Why does TCPDF ignore my inline CSS?

只愿长相守 提交于 2019-11-26 09:27:34
问题 I am trying to create a PDF file using TCPDF. But When I tried to insert inline CSS into the HTML, it\'s displaying a blank page! Here are a few lines of my HTML: pdf->AddPage(); // set font $pdf->SetFont(\'helvetica\', \'B\', 20); $pdf->Write(0, \'Example of HTML Justification\', \'\', 0, \'L\', true, 0, false, false, 0); // create some HTML content $html = \' <div id=\"wrapper\" style=\"width:900px;height:auto;margin:0 auto;\"> <div id=\"header\" style=\"width:900px;height:180px;border

How to implement custom fonts in TCPDF

戏子无情 提交于 2019-11-26 08:20:45
问题 In TCPDF, there are only a few fonts to choose from, to create pdf files. I want to set Tahoma as my pdf font. How can I include Tahoma in TCPDF?? 回答1: The latest TCPDF version automatically convert fonts into TCPDF format using the addTTFfont() method. For example: // convert TTF font to TCPDF format and store it on the fonts folder $fontname = TCPDF_FONTS::addTTFfont('/path-to-font/FreeSerifItalic.ttf', 'TrueTypeUnicode', '', 96); // use the font $pdf->SetFont($fontname, '', 14, '', false);