mpdf

mpdf import all pages from another pdf document

坚强是说给别人听的谎言 提交于 2019-12-04 03:19:51
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? Use page count you get form setting source file in a loop (like below) $pdf = new mPDF(); $pdf->SetImportUse(); $pagecount = $pdf->SetSourceFile($dashboard_pdf_file); for ($i=1; $i<=$pagecount;

mpdf not working in Google Chrome but working fine in firefox

回眸只為那壹抹淺笑 提交于 2019-12-03 21:40:06
问题 Again am stuck into a situation while creating PDF document usong mPDF. I have done the following code which works fine in Firefox and Safari but not working in Google Chrome. require_once 'mpdf60/mpdf.php'; $mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $stylesheet = file_get_contents('css/style.css'); $mpdf->WriteHTML($stylesheet,1); $mpdf->WriteHTML($test, 2); $mpdf->Output(); Can anyone please guide me on how

How to create editable Pdf form in php

夙愿已清 提交于 2019-12-03 17:49:43
问题 I have a simple form and I want to make it editable in pdf using php. But the pdf is creating the form but I can't edit and submit it, any reason or I can't edit pdf using php? My code is <?php define('_MPDF_PATH','/'); include("mpdf.php"); $html = ' <form action="test.php"> <input type="text" id="name" value="name" /> <input type="reset" name="reset" value="Reset" /> <input type="submit" name="submit" value="Submit" /> </form>'; $mpdf=new mPDF('c'); $mpdf->default_lineheight_correction = 1.2

How to get a page count in an mPDF document?

醉酒当歌 提交于 2019-12-03 10:54:32
Does anybody knows how to get the number of generated pages if a PDF document using mPDF library? 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! You can use {nbpg} , like <div align="center"><b>{PAGENO} / {nbpg}</b></div> The answer can be foound in the original documentation: http:/

How to set custom page size in mPDF?

房东的猫 提交于 2019-12-03 09:45:40
问题 I need some help with mPDF. I want to set up my custom page size (exactly: width 49mm and height 200mm), but I can not find solution. I found mPDF() manual (http://mpdf1.com/manual/index.php?tid=184) but there are only ready formats like A4, B5 etc. I have to set up my own page format. 回答1: There is an example that shows how to initiate the page with width and height. // Define a page size/format by array - page will be 190mm wide x 236mm height $mpdf=new mPDF('utf-8', array(190,236)); 来源:

How to create editable Pdf form in php

﹥>﹥吖頭↗ 提交于 2019-12-03 07:28:45
I have a simple form and I want to make it editable in pdf using php. But the pdf is creating the form but I can't edit and submit it, any reason or I can't edit pdf using php? My code is <?php define('_MPDF_PATH','/'); include("mpdf.php"); $html = ' <form action="test.php"> <input type="text" id="name" value="name" /> <input type="reset" name="reset" value="Reset" /> <input type="submit" name="submit" value="Submit" /> </form>'; $mpdf=new mPDF('c'); $mpdf->default_lineheight_correction = 1.2; // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML(

MPDF full page background

谁说胖子不能爱 提交于 2019-12-02 22:03:05
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 the same value as the image. place absolute positioned div with background image same but with img

Creating html table php

倾然丶 夕夏残阳落幕 提交于 2019-12-02 16:48:11
问题 Hi guys I'm quite new in php. I want to create a string of html table to later use it mpdf but in the course of constructing my table the code seems ok but no html table with data generated just the header. Below is my code: $html ='<div class="row"> <div class="col-lg-12"> <table width="100%" class="table table-striped table bordered"> <thead> <tr> <th class="text-left">Code</th> <th class="text-left">Phone Number</th> <th class="text-left">Delivery Date</th> <th class="text-left">Amount HT<

How to make mPDF 6.1 work with PHP 7.1.5

青春壹個敷衍的年華 提交于 2019-12-02 12:34:46
问题 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

Creating html table php

醉酒当歌 提交于 2019-12-02 10:06:21
Hi guys I'm quite new in php. I want to create a string of html table to later use it mpdf but in the course of constructing my table the code seems ok but no html table with data generated just the header. Below is my code: $html ='<div class="row"> <div class="col-lg-12"> <table width="100%" class="table table-striped table bordered"> <thead> <tr> <th class="text-left">Code</th> <th class="text-left">Phone Number</th> <th class="text-left">Delivery Date</th> <th class="text-left">Amount HT</th> <th class="text-left">Amount TVA</th> <th class="text-left">Amount TTC</th> <th class="text-left"