mpdf

PHP: mPDF / pdf library / is it possible to create multiple pdf files in a loop?

懵懂的女人 提交于 2019-12-11 04:12:17
问题 I'm using mPDF library and I'm trying to write a code which will create multiple PDF files at one call (with one opening of: test.php). Problem: always only the first file is downloaded. I know that the question may seems stupid, I've tried to dive deep into google but I can't figure out how to solve this. Maybe someone could lead me on the right path? My logic is: - I have one array with all of orders; for each order I would like to create PDF. - I loop the array and each time call the MPDF

mPDF in CodeIgniter page orientation won't do landscape

匆匆过客 提交于 2019-12-10 15:58:32
问题 I'm using mPDF in CodeIgniter. here is my lib (pdf.php) class pdf { function pdf() { $CI = & get_instance(); log_message('Debug', 'mPDF class is loaded.'); } function load($param=NULL) { include_once APPPATH.'/third_party/mpdf/mpdf.php'; if ($params == NULL) { $param = '"en-GB-x","A4","","",10,10,10,10,6,3,"L"'; } return new mPDF($param); } } this is my controller $filename = 'qwerty'; //... // As PDF creation takes a bit of memory, we're saving the created file in /downloads/reports/

how to add multiple css file in mpdf

我们两清 提交于 2019-12-10 13:27:34
问题 I am trying to convert my html page into pdf format using mpdf. problem is that i am unable to apply more than one css to pdf file.. here is my code of php <?php $html =file_get_contents('mpdf/test.html'); include("../mpdf.php"); $mpdf=new mPDF(); $mpdf->SetDisplayMode('fullpage','two'); // LOAD a stylesheet 1 $stylesheet = file_get_contents('assets/css/main.css'); $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text // LOAD a stylesheet

Changing the default filename when using mPDF

做~自己de王妃 提交于 2019-12-09 02:47:15
问题 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(

mPDF error: Unable to find xref table

你。 提交于 2019-12-08 19:04:27
When I am trying to upload a pdf file and separating each page as pdf, with some pdf files it is working but some of pdf files show this error: mPDF error: Unable to find xref table -" Maybe a Problem with auto_detect_line_endings" My code: ini_set('memory_limit', '512M'); $pagecount = Model::count_pages($documentPath.$journalDoc); for ($i=1; $i<=$pagecount; $i++) { $pdf = new mPDF('','Letter',12,'helvetica, sans-serif',200,0,0,20,0,10,'P'); $pdf->SetImportUse(); $pdf->SetSourceFile($documentPath.$journalDoc); $import_page = $pdf->ImportPage($i); $pdf->UseTemplate($import_page); $pdf->Output(

Glyphicon / FontAwesome not showing in mPDF HTML export

China☆狼群 提交于 2019-12-08 11:25:48
问题 I am using mPDF and when exporting HTML content to pdf, all contents are showing perfectly. But glyphicons are not showing. So I add font awesome style code in /application/third_party/mpdf/config_fonts.php as follows "fontawesome" => array( 'R' => "fontawesome-webfont.ttf" ), And changed the code in view page <i class="fa fa-phone"></i> to <span style="font-family: fontawesome;"></span> After doing that I got fontawesome inside pdf. Is there any way to use <i class="fa fa-phone"></i> to

create dynamic invoice bill using mpdf

帅比萌擦擦* 提交于 2019-12-08 06:01:29
问题 MPDF $html=' <body> <div id="page"> <div id="logo"> <a href="http://www.danifer.com/"><img src="./HTML Invoice Template_files/invoice_logo.jpg"></a> </div><!--end logo--> <div id="address"> <p><strong>'.$company.'</strong><br> <a href="mailto:'.$dbobj->getAdminEmail().'">'.$dbobj->getAdminEmail().'</a> <br><br> Transaction # xxx<br> Created on 2008-10-09<br> </p> </div><!--end address--> <div id="content"> <p> <strong>Customer Details</strong><br> Name: '.$dbobj->UserFullName().'<br> Email: '

mPDF error: Unable to find xref table

陌路散爱 提交于 2019-12-08 04:51:04
问题 When I am trying to upload a pdf file and separating each page as pdf, with some pdf files it is working but some of pdf files show this error: mPDF error: Unable to find xref table -" Maybe a Problem with auto_detect_line_endings" My code: ini_set('memory_limit', '512M'); $pagecount = Model::count_pages($documentPath.$journalDoc); for ($i=1; $i<=$pagecount; $i++) { $pdf = new mPDF('','Letter',12,'helvetica, sans-serif',200,0,0,20,0,10,'P'); $pdf->SetImportUse(); $pdf->SetSourceFile(

Images with https in mpdf

那年仲夏 提交于 2019-12-07 21:52:45
问题 I am using MPDF to generate a pdf with images. With http:// all works fine, but after changing my whole site to https:// I only get red crosses where the images should appear. If I watch the generated file as html version, the images are all there, with https://, but in the generated PDF they are just not shown. Any hint? UPDATE: Error was because of CURL ("SSL certificate problem: unable to get local issuer certificate") It was resolved by adding curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,

Fatal error: Switch statements may only contain one default clause in mpdf.php

自闭症网瘾萝莉.ら 提交于 2019-12-07 15:20:44
问题 I am using mPDF and it is working fine with localhost. I upload the project to live server and it is not generating pdf correctly. <?php // HTML ommited $body = ob_get_clean(); include ("mpdf/mpdf.php"); $mpdf = new mPDF('+aCJK', 'A4', '', '', 0, 0, 0, 0, 0, 0); $mpdf->WriteHTML($body); $mpdf->Output('SaveToPDF.pdf', 'D'); On the top, I put the error show code. To see the error what is going wrong I have the following error. Fatal error: Switch statements may only contain one default clause