mpdf

MPDF E-mail Attachment Sends Blank PDF

别等时光非礼了梦想. 提交于 2019-12-01 01:13:46
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 = chunk_split(base64_encode($content)); $mailto = 'sample@sample.com'; $from_name = 'KIREA'; $from_mail =

PHP: Adobe Reader can't open PDF files created with mpdf

霸气de小男生 提交于 2019-11-30 22:35:16
I'm using mpdf to create PDF files on the fly, and the files open fine in a browser but Adobe gives me an error: Adobe Acrobat Reader DC could not open 'example-filename.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded). I looked at other questions about this ( another mpdf + adobe error ), and checked out the pdf in a text editor. I found that the first part of the file looked like this: <!DOCTYPE html> <head> <title> CapstoneDB </title> %PDF-1.4 %âãÏÓ After I removed

Auto download mpdf generated pdf document

隐身守侯 提交于 2019-11-30 14:31:01
问题 I am newbie for mpdf so don't mind if you feel this question is stupid one:), I generated the pdf document usinf mPDF class , the issue is that after pdf generated the browser opens it in tab . But i want it not to open but auto download , My code is like follwing.. include("../mpdf.php"); $html="my HTML code here !"; $mpdf=new mPDF('c','A4','','',32,25,27,25,16,13); $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $stylesheet = file_get_contents('mpdfstyletables.css');

PHP - How to use mPDF to merge PDFs

蹲街弑〆低调 提交于 2019-11-30 13:57:55
I will start out by saying that I can generate PDFs just fine with mPDF, but for the life of me, I can't get it to merge an existing PDF with the PDF it just generated. What I need to figure out is how to append/add the existing PDF to the newly generated PDF. I've tried using the mPDF methods for importing pages, but all I can get is an error like: mPDF error: Cannot open '/downloads/test.pdf'. The above message is ambiguous and unclear as to WHY it can't open the file... Here's the code I'm using to try and merge PDFs: include_once("./pdf/mpdf/mpdf.php"); $output_file = $_GET['output_file'];

Auto download mpdf generated pdf document

烂漫一生 提交于 2019-11-30 10:54:02
I am newbie for mpdf so don't mind if you feel this question is stupid one:), I generated the pdf document usinf mPDF class , the issue is that after pdf generated the browser opens it in tab . But i want it not to open but auto download , My code is like follwing.. include("../mpdf.php"); $html="my HTML code here !"; $mpdf=new mPDF('c','A4','','',32,25,27,25,16,13); $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet,1); $mpdf->WriteHTML($html); $mpdf->Output('mpdf.pdf'); I am expecting

FontAwesome Icons won't Show on Generated PDF using mPDF

谁说胖子不能爱 提交于 2019-11-30 09:51:47
问题 I am using mPDF in generating payslips. However, the icons in the payslip aren't showing once it is generated. It only leaves a blank space just like this: Icons should show on those highlighted spots. So far, here's what I've done: I am using Yii2 PHP framework and here's my action controller: public function actionPdf($id) { $model = $this->findModel($id); $earnings = EarningDetails::find()->where(['payslip_id' => $model->_id, 'status' => 1])->all(); $deductions = DeductionDetails::find()-

mPDF auto print issue

 ̄綄美尐妖づ 提交于 2019-11-30 08:59:24
I'm using a php class, mpdf, which generates PDF's very nicely. I'm trying to get the file to automatically print (i.e., open the print dialog) when rendered. I've extended the core functioning with the code below to add javascript to the pdf. The pdf is rendered but without auto-printing. Any help would be great. Thanks! require('mpdf.php'); class PDF_JavaScript extends mPDF { var $javascript; var $n_js; function IncludeJS($script) { $this->javascript=$script; } function _putjavascript() { $this->_newobj(); $this->n_js=$this->n; $this->_out('<<'); $this->_out('/Names [(EmbeddedJS) '.($this->n

mPDF 5.7.1 - image displays as a broken [x]

限于喜欢 提交于 2019-11-30 06:40:27
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"> and copying the image into the folder because I don't know into which folder I should copy file

PHP mPDF save file as PDF

强颜欢笑 提交于 2019-11-29 22:17:54
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_ID,WSA_API_KEY); $result=$WSAclient->viewReport($reportID,WSA_SUBSCRIPTION_ID,'xml','EN'); unset(

mPDF auto print issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 12:38:06
问题 I'm using a php class, mpdf, which generates PDF's very nicely. I'm trying to get the file to automatically print (i.e., open the print dialog) when rendered. I've extended the core functioning with the code below to add javascript to the pdf. The pdf is rendered but without auto-printing. Any help would be great. Thanks! require('mpdf.php'); class PDF_JavaScript extends mPDF { var $javascript; var $n_js; function IncludeJS($script) { $this->javascript=$script; } function _putjavascript() {