mpdf

mPDF results from PHP with variables via buffer

不羁岁月 提交于 2019-12-23 02:22:30
问题 Cannot seem to get this to work, everything from the buffer is showing but no PDF generated, if its all in the php as $html = 'Hello World' it generates fine? -- REVISED QUESTION -- included example code to display certificate background image in generated PDF - results are blank PDF... screen shot of div.php run by itself. -- REVISED ENTIRE CODE EXAMPLE -- <?php error_reporting(E_ALL);?> <?php include $_SERVER['DOCUMENT_ROOT'].'/TestCert/mpdf/mpdf.php'; $mpdf=new mPDF(); //include ('div.html

mPDF set Height for SetHTMLHeader

烈酒焚心 提交于 2019-12-22 10:58:59
问题 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. 回答1: 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 回答2: UPDATE 2019 Since version 7 parameter set as an array: $mpdfConfig = array( 'mode' =>

MPDF No Output (Blank Page)

馋奶兔 提交于 2019-12-22 10:53:13
问题 I'd installed the MPDF utility in order to convert HTML&CSS to PDF reports. So far things have been working just fine, until I've tried converting certain page to PDF ,and there's no output. I have to mention that i'm able to display the page regularly through browser - the problem only comes up when i'm trying to convert it to PDF - then I receive blank page. Moreover, there are no encoding problems (part of the output is written in Hebrew, but I've already overcame this obstacle) Here's

MPDF full page background

倖福魔咒の 提交于 2019-12-20 09:56:52
问题 I spent way too much time on this and I can't figure out a good 21th century solution. Simply I have to generate a business card in PDF with a background image, but MPDF isn't very helpful. By default I had: @page{ sheet-size: 90mm 55mm; margin: 0; } I tried to: use @page{ background-size: 100%; } doesn't work use @page{ background-size: cover; } doesn't work resize the image - even if I set the right size in 'mm', it will be smaller or larger, even if I set the background-image-resolution to

Mpdf : Set 0 margin for page 1 only

我怕爱的太早我们不能终老 提交于 2019-12-20 06:32:15
问题 $mpdf = new \Mpdf\Mpdf([ 'tempDir' => __DIR__ . '/temp' ]); $mpdf->SetMargins(0, 0, 0); // will set it to 0 for all pages. Is it possible to have 0 margins for page 1 of a PDF page and default margins for the rest of pages of the document ? I'm currently testing this with Version 7.0. 回答1: If you do not need automatic content overflow for page 1 and other pages, you can use AddPageByArray() method: $mpdf = new \Mpdf\Mpdf([]); $mpdf->AddPageByArray([ 'margin-left' => 0, 'margin-right' => 0,

Mpdf : Set 0 margin for page 1 only

泄露秘密 提交于 2019-12-20 06:31:07
问题 $mpdf = new \Mpdf\Mpdf([ 'tempDir' => __DIR__ . '/temp' ]); $mpdf->SetMargins(0, 0, 0); // will set it to 0 for all pages. Is it possible to have 0 margins for page 1 of a PDF page and default margins for the rest of pages of the document ? I'm currently testing this with Version 7.0. 回答1: If you do not need automatic content overflow for page 1 and other pages, you can use AddPageByArray() method: $mpdf = new \Mpdf\Mpdf([]); $mpdf->AddPageByArray([ 'margin-left' => 0, 'margin-right' => 0,

mPDF document auto height (POS printer)

牧云@^-^@ 提交于 2019-12-20 04:53:28
问题 I'm trying to create a PDF file using mPDF class and I need it to auto-height my document and not create blank spaces at bottom. Here's two images of two different generated PDF with different contents. The left image has more content than the right image, therefore it creates a larger space at the bottom. I want it to have no space at all. So far, this is what I have tried. public function __construct() { /* * Encoding * Size (Array(Xmm, Ymm)) * Font-size * Font-type * margin_left * margin

mPDF: long text in table td shrinks to small size

廉价感情. 提交于 2019-12-20 03:27:13
问题 I am posting an entire html to mpdfp. It works fine. But when the content in table is more or there is an email address or website name in the column (td) the font size of the text shrinks to unreadable font. What must be the issue? Please help on this. Check the attached image for the issue. Thanks 回答1: As noted in this question: Text becomes small when string is too large in MPDF mPDF automatically reduces font size in tables. There is a maximum shrink factor set in $this->shrink_tables_to

How to use mPDF for Chinese Language

杀马特。学长 韩版系。学妹 提交于 2019-12-19 08:27:25
问题 I am using mPDF to save form input data to PDF. For English, it is working fine. Anyone can use this code to save HTML Form data to PDF. Issue: In order to fulfill my project requirement I need to use the Chinese Language. My current code is not working for that. Form.html <form action='processPDF.php' method='post'> <label for="name">Name</label> <input name="name" type="text" id="name"> <input type='submit' name='submit' value='Download PDF'> </form> processPDF.php <?php header('Content

MPDF E-mail Attachment Sends Blank PDF

狂风中的少年 提交于 2019-12-19 04:20:37
问题 I have successfully generated a PDF using mpdf, which I have verified by downloading the PDF. However, when I send the PDF as an e-mail attachment I receive a blank PDF with an "Out of Memory" error by Adobe Reader. Below is my code: <?php include("MPDF57/mpdf.php"); ob_start(); include "Receipt_Template_2.php"; $template = ob_get_contents(); ob_end_clean(); $mpdf=new mPDF('','A4','','',32,25,27,25,16,13,'L'); mpdf->WriteHTML($template); $content = $mpdf->Output($template, 'S'); $content =