tcpdf

How to change footer of a particular page with a particular header title in TCPDF

为君一笑 提交于 2020-01-03 02:21:09
问题 Iam creating multiple pages in TCPDF using AddPage() method. When creating a second page , i call setHeaderData() method to set a header name. In some cases the first page might overflow and auto page break. I need to identify the page before the first page having the header title set and change its footer only. How to achieve this using TCPDF. 回答1: One solution is to set a new property that will identify this page when the Footer() method is called by TCPDF. The example below sets a new

TCPDF list item margin

☆樱花仙子☆ 提交于 2020-01-02 07:23:13
问题 Couldn't find it anywhere. Having list: <ol> <li>Foo</li> <li>Bar</li> <li>Baz</li> </ol> and CSS: ul li, ol li{ margin-bottom: 10px; } While previewing list in browser, margin-bottom is interpreted correctly. Unfortunately, TCPDF somehow doesn't recognize this style (while recognizing other parts of included css file). Is there any trick/hack to make it work? 回答1: tcpdf allows to define the vertical spaces for HTML tags, see Method setHtmlVSpace of TCPDF Class Documentation, use: $pdf-

TCPDF list item margin

别来无恙 提交于 2020-01-02 07:23:11
问题 Couldn't find it anywhere. Having list: <ol> <li>Foo</li> <li>Bar</li> <li>Baz</li> </ol> and CSS: ul li, ol li{ margin-bottom: 10px; } While previewing list in browser, margin-bottom is interpreted correctly. Unfortunately, TCPDF somehow doesn't recognize this style (while recognizing other parts of included css file). Is there any trick/hack to make it work? 回答1: tcpdf allows to define the vertical spaces for HTML tags, see Method setHtmlVSpace of TCPDF Class Documentation, use: $pdf-

TCPDF - Having footer/header on certain pages only

不问归期 提交于 2020-01-02 04:50:13
问题 I want to place the footer section on every page of my document except the first one. I created my custom footer by extending the TCPDF class and overriding its footer method. Then based on the documentation and using below example I understand I should use SetPrintHeader and SetPrintFooter methods: http://www.tcpdf.org/examples/example_002.phps // Page one $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); // Page two and on .. $pdf->SetPrintHeader(true); $pdf-

TCPDF set bottom margin zero

被刻印的时光 ゝ 提交于 2020-01-01 04:01:12
问题 I am creating pdf using TCPDF in php,I need to include my data into pdf without bottom margines,The data will be included at the end of the page. $pdf->SetLeftMargin(14); $pdf->SetTopMargin(6); $pdf->SetFont($fontname, '', '9'); $pdf->setPrintHeader(false); $pdf->SetFooterMargin(0); $pdf->setPrintFooter(false); $pdf->AddPage(); $pdf->writeHTML($html, true, 0, true, 0); I am using the above code.Anyone know how to remove margin space from pdf using tcpdf? 回答1: Margin that you are seeing is due

tcpdf: poor image quality

[亡魂溺海] 提交于 2019-12-30 17:31:51
问题 I am using TCPDF to create PDF files converted from HTML input using it's writeHTML() function. However, images within the PDF have poor quality, while the original images have a high quality (as expected). The images are in PNG format. I already tried to use SetJPEGQuality(100), but that had no effect. What is causing this? 回答1: Try using this: $pdf->setImageScale(1.53); http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4831671 回答2: When using HTML to generate your PDFs you

How to overlay HTML generated PDF on top of existing PDF?

最后都变了- 提交于 2019-12-28 19:34:08
问题 I'm looking to start with an initial PDF file, one that has graphics and text, and then take some html code which has dynamic values for some user input, generate that as a PDF, hopefully either using the initial PDF as a background, OR somehow running a PHP script afterwards to "merge" both PDF where one acts as a background to another. I have some code that renders an HTML formatted PDF: (using DOMPDF) $initialpdf = file_get_contents('file_html.html'); $initialpdf = str_replace(array( '

TCPDF ERROR: [Image] Unable to get image

不问归期 提交于 2019-12-28 14:05:08
问题 I'm using TCPDF with Drupal's print module to generate PDF of articles, & ending up with following error message when I click the link to generate PDF: TCPDF ERROR: [Image] Unable to get image: http://localhost/pathToDrupal/themes/bartik/logo.png The Image exists in the location specified. I tried applying: allow_url_fopen = On; allow_url_include = On; in php.ini but that could not resolve the problem. Please care to help :( 回答1: Apparently the "fopen"-wrappers are not used by TCPDF. If you

TCPDF HTML with Special Characters displays empty PDF file

二次信任 提交于 2019-12-28 13:34:30
问题 I am using TCPDF Library Version: 5.9.011. I am trying to execute HTML layout as PDF. For which I tried with example provide with the site $html = '<h1>HTML Example</h1> <h2>List</h2> Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash '; // output the HTML content $pdf->writeHTML($html, true, false, true, false, ''); //Close and output PDF document $pdf->Output('example_006.pdf', 'I'); Apparently found that generated PDF only default header and footer with

TCPDF not render all CSS properties

心已入冬 提交于 2019-12-28 05:39:05
问题 I try to make a PDF writing CSS and HTML but my CSS doesn't appear in my PDF. The only thing considered is the font-size and font-color. I give you the code (sorry, it's a little long...) $config = sfTCPDFPluginConfigHandler::loadConfig('my_config'); $doc_title = "Fiche Logement"; $html = <<<EOF <style> .informations { padding: 10px; margin: 10px; border: 1px dotted black;} .informations table { margin-top: 10px;} #modif { margin: 20px; text-align: left; float: right;} #modif th { padding