mPDF- Script to create PDF from HTML using PHP on the Fly

In my previous post I have discussed creating a PDF file form HTML code using PHP on the fly through domPDF library. These kind of requirements generally come up when you creating accounting softwares and are required to send an online invoice, quote or any other confidential document to customer or any user through email.

Creating a PDF form HTML has always been a pain for PHP developers. Yes, there are some web services available on the internet who can do this job pretty well. But what happens if the web service is down? Your daily work can stuck up and can cause loss in business and time.

PHP Developers now listen Loud and Clear.

Here we are with yet another flawless script to create PDF form HTML “mPDF“. This set of php library overcomes all the set backs of domPDF like nested tables were not allowed (still in early stage of development), strict HTML, any carelessness in writing code will lead you in lot of errors. This causes heavy loss of development time.

mPDF makes all the tasks easy. Its an intelligent script to create PDF form HTML using PHP on the fly.

Exclusive Features of mPDF-

mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML- by Ian N Back

– UTF-8 encoded HTML
– Almost all languages including RTL (arabic and hebrew), and CJK – (chinese-japanese-korean)
– Bookmarks
– CSS stylesheets
– Word spacing and character spacing for justification
– Nested block-level elements (e.g. P, DIV) including margins, borders, padding, line-height, background colours etc.
– Page layout and orientation
– Page numbering
– Odd and even paging with mirrored margins
– Page headers & footers
– Columns
– Tables – nested tables, rotated, or autosized to fit on a page
– Text-justification and hyphenation
– Table of contents
– Index
– Images as JPG GIF PNG WMF
– Watermarks
– Password protection.

What Else You Want????

Remember to get the Sample demo file I have created for you to get you started after set up of mPDF on your system.

Get mPDF from official website

Click here to view this in action. Sample demo file.

Instructions– Place the above sample file in the root folder of your application where mpdf folder is located. The structure should be like below:

– MyWebsite (your own Folder main application)
+ mPDF (Folder all the files)
– Sample PHP file above

More information on the usage can be found in the below official documentaiton.

Documentation and Manual for usage-

mPDF official Website-

Both comments and pings are currently closed.

3 Responses to “mPDF- Script to create PDF from HTML using PHP on the Fly”

  1. UncleCode.Com – Technology Blog | Create PDF from HTML using PHP on the Fly using mPDF free to use was a high quality article. I might like to write like this too – taking time and actual effort to make a very good post… however what can I say… I postpone alot and never seem to get anything done.

  2. Nestor Koor says:

    Useful info and wonderful design you got right here! I want to thank you for sharing your thoughts and putting the time into the stuff you post! Great work!

  3. I observed your article on google and I need to admit it’s fantastic. I’ve obtained a web site too, and I’m making reviews of a fantastic produtc, Muscle Warfare, which aids you building yous muscles much quicker with organic elements. Go to my site and also have a seem.