mpdf

Border around the page in PDF with MPDF

北慕城南 提交于 2019-12-07 14:44:07
问题 I have an html page that has borders around, but when I use the MPDF, he breaks a div and not puts border above or down of the broken div, does anyone know how to fix it, or let each page with border around? 回答1: Perhaps you could try a hack using watermarks: http://www.olivettorestaurante.com.br/mpdf/examples/example35_watermarks.php A full page square image used as watermark could work. I know, a bit triky, but sometimes MPDF turns weird when facing some problems... :/ A better answerd

How to get the total number of pages in MPDF?

安稳与你 提交于 2019-12-06 20:50:59
问题 I'm using PHP MPDF to create PDF files. At the footer I'm able to print the current page number using {PAGENO} But how do I get the total number of pages in the PDF file? So that in the footer I can print like: Page (Current Page) of (Total number of pages) Page 1 of 6 回答1: According to the official documentation: $mpdf=new mPDF(); $mpdf->setFooter("Page {PAGENO} of {nb}"); 回答2: you can use {nb} it gives you total number of pages in mpdf 来源: https://stackoverflow.com/questions/17083746/how-to

Images with https in mpdf

元气小坏坏 提交于 2019-12-06 05:10:16
I am using MPDF to generate a pdf with images. With http:// all works fine, but after changing my whole site to https:// I only get red crosses where the images should appear. If I watch the generated file as html version, the images are all there, with https://, but in the generated PDF they are just not shown. Any hint? UPDATE: Error was because of CURL ("SSL certificate problem: unable to get local issuer certificate") It was resolved by adding curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); to mpdf.php Answer was found here: curl: (60) SSL certificate : unable to get local issuer

How to use Font Awesome with MPDF?

空扰寡人 提交于 2019-12-06 04:26:48
问题 I am using Zend Framework and creating PDF with mpdf. I am trying to use fontawesome for denoting some of the articles but the fonts of font awesome are not rendering properly below is the code . $stylesheet = file_get_contents("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"); $stylesheet .= file_get_contents("https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"); $this->mpdf->WriteHTML($stylesheet,1); $this->mpdf->WriteHTML($html,2); $this-

Fatal error: Switch statements may only contain one default clause in mpdf.php

北战南征 提交于 2019-12-06 03:52:40
I am using mPDF and it is working fine with localhost. I upload the project to live server and it is not generating pdf correctly. <?php // HTML ommited $body = ob_get_clean(); include ("mpdf/mpdf.php"); $mpdf = new mPDF('+aCJK', 'A4', '', '', 0, 0, 0, 0, 0, 0); $mpdf->WriteHTML($body); $mpdf->Output('SaveToPDF.pdf', 'D'); On the top, I put the error show code. To see the error what is going wrong I have the following error. Fatal error: Switch statements may only contain one default clause in /customers/d/e/a/....URL..GO..HERE/mpdf.php on line 1432 I am using PHP Version 5.6.31 on my

mPDF set Height for SetHTMLHeader

怎甘沉沦 提交于 2019-12-05 22:54:09
Exist any way to set the Height of hearder when use SetHTMLHeader function? In the first page the size by default is correct but in the next pages, the content overwrite the end part of the header. Regards, Oscar. Oscar Fernández Arcís Finally use this: $this->mpdf->mPDF('utf-8','A4','','','15','15','28','18'); When 15=margin-left , 15=margin-right , 28=margin-top , 18=margin-bottom And now works well. Regards, Oscar Sarah Trees UPDATE 2019 Since version 7 parameter set as an array: $mpdfConfig = array( 'mode' => 'utf-8', 'format' => 'A4', 'margin_header' => 30, // 30mm not pixel 'margin

Border around the page in PDF with MPDF

删除回忆录丶 提交于 2019-12-05 19:26:21
I have an html page that has borders around, but when I use the MPDF, he breaks a div and not puts border above or down of the broken div, does anyone know how to fix it, or let each page with border around? Perhaps you could try a hack using watermarks: http://www.olivettorestaurante.com.br/mpdf/examples/example35_watermarks.php A full page square image used as watermark could work. I know, a bit triky, but sometimes MPDF turns weird when facing some problems... :/ A better answerd would be wellcome. Here is the sampl code available in the MPDF examples directory, related to watermarks: <?php

Footer in last printed page MPDF

╄→尐↘猪︶ㄣ 提交于 2019-12-04 13:00:19
Hi i am using MPDF but i cant print footer on the last page, i am printing 2-7 pages this is my code for footer $mpdf->SetHTMLFooter(' <div id="firmas"> <table width="100%"><tr> <td><br><br><br><br><br><small><h3><font face=\'Arial\'>Recibí Conforme</font> </h3><small> </td><td><br><br><br><br><small><h3><font face=\'Arial \'>Vo.Bo</font> </h3><small></td><td><small><br><br><br><br><br><h3><font face=\'Arial\'>Entregue Conforme</font></h3><small></td> </tr> </table> </div> '); I would like to display this in the last page and not in every page. Try first WriteHTML then SetHTMLFooter, order

MPDF - Start page numbering from number 10 on the first sheet

我怕爱的太早我们不能终老 提交于 2019-12-04 04:58:18
问题 I have an application and need to print a document using the MPDF class, however necessary that the number of page start at number 43, 44, 45 and so on. And not from the 1, 2, 3 ... I managed to start from the 43 but only jumping a leaf. I can not insert a pagebreak. Thanks. Below is my code. $mpdf = new mPDF(); $mpdf->setFooter("{PAGENO}"); $numero_paginas = "{nb}"; $mpdf->SetHTMLHeader(' <table> <tr> <td> <img src="img/cabecalho.png" /> </td> </tr> </table> <hr> '); $mpdf->SetHTMLFooter('')

Upgrade to PHP7.1 and MPDF show error - A non-numeric value encountered at line 30648

纵饮孤独 提交于 2019-12-04 04:02:45
I'm using PHP 5.x and mPDF 6.x for long time. This week I decide to upgrade system to PHP7.1 but still using mPDF6. I face some problem after upgrading. PROBLEM 1:: Console show error message: constructer with the same name as class name is deprecate. I go through each php files and find classes, then replace constructer function with __construct(...) PROBLEM 2:: Console show error message:: Can not assign property ID to $attr I go to file mPDF.php in function MergeCSS(...). I add new line of code at third line. if (empty($attr)) { $attr = array();} PROBLEM 3:: Console show error message