mpdf

Adobe Reader cannot open .pdf file created using mPDF in Zend Framework

房东的猫 提交于 2019-12-12 16:04:20
问题 I'm trying to generate a .pdf file using mPDF in a Zend Framework application, from the output of the action. Here is the code of my action: public function testAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); $this->view->foo = 'bar'; $this->render(); $output = $this->getResponse()->getBody(); $layout = new Zend_Layout(); $layout->content = $output; $layout->setLayoutPath(dirname(dirname(__FILE__)) . '/views/layouts/'); $layout->setViewSuffix(

mpdf import all pages from another pdf document

狂风中的少年 提交于 2019-12-12 08:38:17
问题 I want to be able to append an entire pdf document in the document I am creating with mpdf. I can import one page using the following code: $mpdf->SetImportUse(); $pagecount = $mpdf->SetSourceFile('testfile.pdf'); $tplId = $mpdf->ImportPage($pagecount, 50, 50, 100, 100); $mpdf->UseTemplate($tplId, '', '', 100, 100); $mpdf->Output(); but is there a way to import all pages rather than just the last page? 回答1: Use page count you get form setting source file in a loop (like below) $pdf = new mPDF

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

自闭症网瘾萝莉.ら 提交于 2019-12-12 07:19:19
问题 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

Convert html page into pdf using php

孤街醉人 提交于 2019-12-12 03:39:43
问题 I have a project that I need to convert HTML-PAGE into PDF-FILE. I have found this repo: https://github.com/mpdf/mpdf. I have cloned it into my computer, and I can't find out what should I do. in the tutrial they give this code below: <?php require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML('<h1>Hello world!</h1>'); $mpdf->Output(); ?> I can't find the directory called "vendor". Thx for your help. 回答1: Preparation In the interest of complete clarity, I'm

Laravel/mPDF non-numeric value encountered ErrorException after PHP upgrade to 7.2

大兔子大兔子 提交于 2019-12-11 17:54:38
问题 I update php7.1 to php7.2.1 (PHP 7.2.1 (cli)) my laravel pdf not generated show below errorr: (1/1) ErrorException A non-numeric value encountered in mpdf.php (line 30648) at HandleExceptions->handleError( 2, 'A non-numeric value encountered', '/opt/lampp/htdocs/mysite/vendor/mpdf/mpdf/mpdf.php', 30648, array( 'size' => 0, 'maxsize' => 190.00155555555551245561218820512294769287109375, 'fontsize' => 3.704166666666667051543981870054267346858978271484375, 'usefontsize' => false) ) in mpdf.php

mpdf not supporting chinese fonts

谁说胖子不能爱 提交于 2019-12-11 15:12:55
问题 I am using mpdf. When I try to write chinese words to the WriteHtml(), the resulting pdf containing square boxes instead of those fonts. require 'mpdf/mpdf.php'; $mpdf->allow_charset_conversion = false; $pdf = $this->pdf->load(); $pdf->useAdobeCJK = true; $pdf->SetAutoFont(AUTOFONT_ALL); $mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8']); $mpdf->SetHeader('|<h2>Booking Invoice</h2>|'); $mpdf->setFooter('{PAGENO}'); $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->SetDisplayMode(

mPDF Auto Generated PDF Mailer sends blank Email

烈酒焚心 提交于 2019-12-11 14:25:42
问题 I am using mPDF class and am successfully able to generate an email with the following code. However, my email comes out blank. I am assuming but am not sure if this has something to do with my headers. It's hard for me to tell because I am getting my emails but am not able open the pdf it generates. include("./mpdf.php"); $mpdf->debug = true; $html2 = ' <div style="margin-left:3%;">Attach additional photos: <input type="file" name="file" id="file" /></div><hr />'; echo $html2; if ( isset( $

Setting a custom TTF Font in mPDF

痞子三分冷 提交于 2019-12-11 09:45:21
问题 i installed mPDF 6.0 via zip file (not composer), put a font into the ttfonts folder and added the file in config_fonts.php like this: "eurostyle" => array( /* Custom */ 'R' => "eurostyle-normal.ttf" ) Now i tried adding the font to my mPDF object like this: $mpdf = new mPDF('c', 'A4-L'); $mpdf -> SetFont('eurostyle'); but nothing changes. There is no error message, the output PDF simpy stays the same. Does anybody know why? 回答1: Create your mPDF object without c as mode parameter. Use an

add Digital Signature using mPDF object

[亡魂溺海] 提交于 2019-12-11 04:49:22
问题 I'm using mPDF to create a PDF. I want to digitally add a signature to the PDF document. I can only find online examples for adding a digital signature to a tcPDF object, not an mPDF. Does anyone have any information on the subject that can help me? This is my PHP code: $pdf=new mPDF('en','A4','','DejaVuSansCondensed',$template->margin_left,$template->margin_right,$template->margin_top,$template->margin_bottom,$template->margin_header,$template->margin_footer); $pdf->setAutoFont(); $pdf-

Yii2 mPdf Kartik: Set Height and Width Paper

ⅰ亾dé卋堺 提交于 2019-12-11 04:16:15
问题 How to set custom height and width on PDF format like this: I want set height: 13.6cm and width: 21.2cm if I export to PDF, paper size is always in A4 format , how to make paper size to be 13.6cm (height) and **21.2cm (width) as in the picture above I use mpdf kartik on yii2 .. this my controller code: $pdf = new Pdf([ 'mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => \Yii::getAlias('@webroot') .'/css/pdf/pdf-pfi.css'