mpdf

mPDF not rendering images (mPDF error: IMAGE Error Could not find image file)

你。 提交于 2019-11-29 06:54:19
We are getting plagued with this which started in April on working server. Everything was fine with our application until the customer reported that PDFs were no longer displaying the images. Our PDF is generated via a HTML render first. When the HTML render is displayed the Image shows correctly. Also the image shows correctly if the image URL as noted in the mPDF is copied and pasted into a new tab. However... If we load the image from a DIFFERENT DOMAIN then the image is rendered correctly. loading the image via absolute path, relative path or URL path all result in this error: mPDF error:

mPDF 5.7.1 - image displays as a broken [x]

戏子无情 提交于 2019-11-29 06:10:20
问题 I have a small issue with mPDF (version 5.7.1). This code should generate PDF with image file: $mpdf = new mPDF(); $html = '<img src="https://www.google.pl/images/srpr/logo11w.png"/>'; $mpdf->WriteHTML($html); $mpdf->debug = true; $output = $mpdf->Output(); exit(); Well there is no image but an [x] instead. I've googled enough to get to the conclusion that it has to be done this way but I also tried realpath to the file. Still nothing. The only thing I haven't tried is <img src="logo11w.png">

mPDF font-size not working for long text in a table

家住魔仙堡 提交于 2019-11-29 03:59:45
Using mPDF to print html to pdf the font-size I set in html is not properly set in creating the pdf. In my html I have <table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-family:myriadpro, Verdana, sans-serif; color:#111111;"> <tr> <td align="left" style="vertical-align:top; padding:5px; font-size: 12pt;"> etc. However mPDF scales the font-size to 9pt in the PDF. If I use 24pt it scales to 18pt. I checked and tried to change the configs and displaypreferences (NoPrintScaling) in mPDF but none of this is working. Has anybody got a clue on how to get rid of this scaling? I

PHP mPDF save file as PDF

牧云@^-^@ 提交于 2019-11-28 19:44:49
问题 I have a page which uses mPDF which when you run displays a PDF in the browser, it can also be saved from here as a PDF no problem. What I would like to happen is when the page is run and generates a PDF that the page is saved as a PDF on the server. Here is the current code: <?php include $_SERVER['DOCUMENT_ROOT'].'/include/seo-check/lib/WSAclient.php'; include $_SERVER['DOCUMENT_ROOT'].'/include/seo-check/lib/WSAParser.php'; $reportID= $_GET['reportid']; $WSAclient = new WSAclient(WSA_USER

TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file

感情迁移 提交于 2019-11-28 13:34:56
The Problem: TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file I gave up on trying to fix the error with TCPDF and installed mPDF only to get the same error when attempting to render the document to the browser. I can save the document just fine and have it displayed in the browser upon retrieval. Additionally, this error only presented itself after switching from my dev server to my host server. Works fine on DEV server (DEV server = WAMPSERVER, PROD server = Hostgator Linux). Troubleshooting: I've read the many volumes of other discussions around the

Generating PDF via AJAX using mpdf

≯℡__Kan透↙ 提交于 2019-11-28 09:56:44
问题 I'm using the mpdf library to generate a PDF of user-generated html. I can get the PDF to save to the server successfully, but I want the PDF to open in the browser for the user. I've tried using mpdf's output options to open the file in the browser or to prompt a download, but neither happens when I use AJAX to send the html data to the script. Here's my AJAX: $('#save').click(function() { var shelf_clone = $('#shelf').clone(); var shelf = shelf_clone.prop('outerHTML'); $.ajax({ type: "POST"

Mpdf different header for first page

血红的双手。 提交于 2019-11-28 07:57:04
问题 I am working on quotation software where I am using mpdf for quotation generation using HTML format. Header are set by code below. $mpdf->SetHTMLHeader($header); $mpdf=>SetHTMLFooter($footer); Which applies uniformly to all pages. But I need different header to first page. How should I achieve it? 回答1: As you wrote, SetHTMLHeader and SetHTMLFooter apply to the entire document. If you want different headers / footers for the first page you will have to remove both $mpdf->SetHTMLHeader($header)

mPDF font-size not working for long text in a table

◇◆丶佛笑我妖孽 提交于 2019-11-27 22:19:02
问题 Using mPDF to print html to pdf the font-size I set in html is not properly set in creating the pdf. In my html I have <table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-family:myriadpro, Verdana, sans-serif; color:#111111;"> <tr> <td align="left" style="vertical-align:top; padding:5px; font-size: 12pt;"> etc. However mPDF scales the font-size to 9pt in the PDF. If I use 24pt it scales to 18pt. I checked and tried to change the configs and displaypreferences

How to get a page count in an mPDF document?

蓝咒 提交于 2019-11-27 17:34:43
问题 Does anybody knows how to get the number of generated pages if a PDF document using mPDF library? 回答1: I was looking for the same functionallity while using EYiiPdf (a wrapper for mPDF on Yii) and the following worked like a charm: $mPDF->setFooter('{PAGENO} / {nb}'); I checked mPDF's source and found this at mpdf.php:1656 (version 5.4): function AliasNbPages($alias='{nb}') { //Define an alias for total number of pages $this->aliasNbPg=$alias; } Hope it helps! 回答2: You can use {nbpg} , like

TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file

倾然丶 夕夏残阳落幕 提交于 2019-11-27 07:46:26
问题 The Problem: TCPDF & mPDF error: Some data has already been output to browser, can't send PDF file I gave up on trying to fix the error with TCPDF and installed mPDF only to get the same error when attempting to render the document to the browser. I can save the document just fine and have it displayed in the browser upon retrieval. Additionally, this error only presented itself after switching from my dev server to my host server. Works fine on DEV server (DEV server = WAMPSERVER, PROD