Questions tagged [mpdf]

mPDF is a PHP library for generating PDF files from HTML with Unicode/UTF-8 and CJK support. It is distributed under the GNU General Public License. Although it is slower than its protoplast (fpdf library) it supports Unicode characters while fpdf does not.

mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF, with a number of enhancements.

1514 questions
47
votes
4 answers

PHP mPDF save file as PDF

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…
Paul
  • 2,465
  • 8
  • 35
  • 60
35
votes
16 answers

mPDF 5.7.1 - image displays as a broken [x]

I have a small issue with mPDF (version 5.7.1). This code should generate PDF with image file: $mpdf = new mPDF(); $html = ''; $mpdf->WriteHTML($html); $mpdf->debug = true; $output =…
Mr.TK
  • 1,743
  • 2
  • 17
  • 22
32
votes
2 answers

Auto download mpdf generated pdf document

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…
Mansoor Jafar
  • 1,458
  • 3
  • 15
  • 31
28
votes
1 answer

how to add css file in mpdf

I am trying to convert html into pdf using mpdf. Problem is that i am unable to apply css to pdf file.. Here is my code of php:
saad
  • 581
  • 1
  • 6
  • 11
26
votes
6 answers

adding font to mPDF

I'm getting the following error when I try and generate a PDF using the mPDF class: TTF file "C:/wamp/www/inc/mpdf/ttfonts/verdana.ttf": invalid checksum 20f65173c11 table: DSIG (expected 65173c11) I've uploaded the font files to my ttfonts…
Paul Dessert
  • 6,363
  • 8
  • 47
  • 74
26
votes
6 answers

How to get a page count in an mPDF document?

Does anybody knows how to get the number of generated pages if a PDF document using mPDF library?
Nikita Gopkalo
  • 559
  • 1
  • 6
  • 13
24
votes
4 answers

Prevent body overlapping footer in mPDF

I'm generating PDFs using mPDF library, and my header and footer vary in size depending on a couple of parameters. A static solution would be to set the footer margin, which will solve the overlapping - but as the footer may vary in size this is not…
Daniel
  • 3,726
  • 4
  • 26
  • 49
23
votes
3 answers

Changing the default filename when using mPDF

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…
Jason
  • 15,017
  • 23
  • 85
  • 116
19
votes
3 answers

mPDF position absolute

I need to generate PDF file from HTML input:
tomas657
  • 5,579
  • 4
  • 16
  • 15
15
votes
4 answers

Uncaught Mpdf\MpdfException: The HTML code size is larger than pcre.backtrack_limit 1000000

I am developing code to generate PDF from HTML code using library MPDF. For HTML Code I am reading from external HTML file. But its not working for larger HTML code size. Is there any way to fix it or do we have any other library which supports my…
Satya Mahesh
  • 339
  • 1
  • 3
  • 14
15
votes
3 answers

MPDF full page background

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; …
seniorpreacher
  • 666
  • 2
  • 11
  • 31
15
votes
3 answers

How to get the total number of pages in MPDF?

I'm using PHP MPDF to create PDF files. At the footer I'm able to print the current page number using {PAGENO} But how do I get the total number of pages in the PDF file? So that in the footer I can print like: Page (Current Page) of (Total number…
sravis
  • 3,562
  • 6
  • 36
  • 73
14
votes
3 answers

How do I install mpdf 7 without composer?

I'm currently using mpdf 6.1 and I'd like to switch to 7. But I can't find a way to install it without composer. Is there a full package that I can download, unzip and test on my localhost?
LuBre
  • 1,789
  • 2
  • 13
  • 9
14
votes
11 answers

Failed to load PDF document in chrome browser

I'm using mPDF library for generating PDF files from HTML page. It is working nice in firefox but it is not display PDF file in chrome browser. I'm getting following error while generate PDF in chrome. Following is my code for generate PDF using…
Ketav
  • 760
  • 1
  • 8
  • 27
14
votes
2 answers

mpdf import all pages from another pdf document

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 =…
Jamie Hall
  • 276
  • 1
  • 3
  • 12
1
2 3
99 100