mpdf

Mpdf : Set 0 margin for page 1 only

你说的曾经没有我的故事 提交于 2019-12-02 09:02:56
$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. 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, 'margin-top' => 0, 'margin-bottom' => 0, ]); $mpdf->WriteHTML($html1); // first page $mpdf->AddPageByArray([

Can't get rid of PHP notices in mPDF

这一生的挚爱 提交于 2019-12-02 05:04:43
问题 I'm using the mPDF library to generate PDF docs directly from HTML output. The problem is that this mPDF library is written as it is and it is generating dozens of notices (undefined index, undefined offset, etc). I tried anything to stop outputting them but nothing yet helped. I tried to put error_reporting(E_ALL ^ E_NOTICE); as well as error_reporting(E_ALL & ~E_NOTICE); which i inserted into my index.php, into the class and method that is directly including mpdf.php and also at the start

How to put line break in mpdf when data is extracted from mysql database

北城余情 提交于 2019-12-02 05:00:53
I am using MPDF to generate pdf files from data stored in mysql database. Though I could extract and display others data as expected, I could not display multiline text as they all comes in single line. Could someone help me to resolve this problem. EG. My data from textarea is shown in database as: One Two Three But in pdf it will ge generated as OneTwoThree When I check in database using phpmyadmin its stored data as One\r\nTwo\r\nThree Please help. Try with this code. $finalString = nl2br($htmlOut); MPDF is for generating PDF from HTML. HTML shows your lines as OneTwoThree, because it does

How to make mPDF 6.1 work with PHP 7.1.5

岁酱吖の 提交于 2019-12-02 03:33:06
Developed on on a WAMP stack with PHP 5.6, then transferred to LAMP 7.1.5 Everything is working OK except for mPDF 6.1.0 which is giving the following: Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 30648 Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 17074 Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf/mpdf.php on line 17075 Warning: A non-numeric value encountered in /var/sites/s/example.com/php_libs/vendor/mpdf/mpdf

REST GET with parameter ignored, PHP Symfony 3 Mpdf

大兔子大兔子 提交于 2019-12-01 14:57:58
Working on a REST API for PDF processor using Mpdf(and tfox symfony bundle) on Symfony 3 Framework. I created two GET requests, one with no parameters for testing, and one with the parameter(URL of the HTML file) I want to read and then convert into PDF. The Generic GET function: /** * * @Rest\Get("/create") */ public function createPDFAction(){ $mpdfService = $this->get('tfox.mpdfport'); $html = "<h1> Hello </h1>"; $mpdf = $mpdfService->getMpdf(); $mpdf->WriteHTML($html); $mpdf->Output(); exit; } The Second GET function with parameter: /** * @param $htmlSource * @Rest\Get("/create/{htmlSource

REST GET with parameter ignored, PHP Symfony 3 Mpdf

*爱你&永不变心* 提交于 2019-12-01 12:36:17
问题 Working on a REST API for PDF processor using Mpdf(and tfox symfony bundle) on Symfony 3 Framework. I created two GET requests, one with no parameters for testing, and one with the parameter(URL of the HTML file) I want to read and then convert into PDF. The Generic GET function: /** * * @Rest\Get("/create") */ public function createPDFAction(){ $mpdfService = $this->get('tfox.mpdfport'); $html = "<h1> Hello </h1>"; $mpdf = $mpdfService->getMpdf(); $mpdf->WriteHTML($html); $mpdf->Output();

mPDF error: Some data has already been output to browser

旧城冷巷雨未停 提交于 2019-12-01 12:28:11
问题 I'm using mpdf to convert and display html to PDF when i run it on my local pc/server i see the pdf, but when i run it on my site server i'm getting this error: mPDF error: Some data has already been output to browser, can't send PDF file $url = "http://".SITE_DOMAIN."/itinPage-printVer.php?itinID=".$_GET['itinID']; $htmlStr = file_get_contents($url); include('html2pdf/mpdf.php'); //ob_end_clean(); $mpdf=new mPDF('utf-8'); $mpdf->WriteHTML( $htmlStr); $mpdf->Output(); exit; Could it be folder

Get position of text in mPDF to determine vertical height of HTML element

混江龙づ霸主 提交于 2019-12-01 11:42:49
问题 I am generating PDFs with the mPDF class and wondering if and how would it be possible to determine the position of the last line of text in document that is generated mPDF? I need an HTML box to be cover in height any remaining space between the last line of text and the bottom margin of the document. By setting the html element to height: 100% that pushes the element to the new page and covering the whole height of the new page. The content of the page is generated dynamically based on a

How to use mPDF for Chinese Language

流过昼夜 提交于 2019-12-01 08:25:06
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-Type: text/html; charset=UTF-8'); if (isset($_POST['submit'])) { if (isset($_POST['name'])) { $name = $

Changing the default filename when using mPDF

懵懂的女人 提交于 2019-12-01 03:12:56
I'm currently using mPDF to generate a pdf from HTML (which was generated by PHP). All works as expected but I'd like to be able to change the default filename. Currently, I have: $payStub=new mPDF(); $payStub->SetTitle('My title'); $payStub->WriteHTML($pcTableRows); $payStub->Output(); When I save the pdf that opened in my browser it defaults to mpdf.pdf . Is it possible to change mpdf.pdf to something of my choosing? I tried $payStub->Output('myFileName.pdf'); and $payStub->Output('myFileName.pdf', 'F'); but those want to save it to the server, I'm trying to have it for when the user saves