Mpdf for php to pdf

Mpdf for php to pdf

Sometimes we need to made pdf file for report or anything.By using mpdf we made a pdf file for our php project.It’s very easy to made a pdf file using php and html.Mpdf support most of the html css code for that we can make a pdf very easily.In this article we discuss how to make a pdf file using mpdf.Mpdf is dependency to use this dependency we need to add this dependency in our project’s composer.json file.Let see how add this dependency in composer.json file

Require mpdf in composer.json file

After that we need to run composer install from terminal for cloning this dependency in our project vendor file.
In composer install there will a possibility to composer timeout because the file size is more than 151 MB.To solve this you need to extend composer timeout.Default composer timeout is 300 seconds.You need to increase that.For extend composer timeout follow the url

Here i give the packagist url.
And also mpdf github url

If you are not using composer.json file you need to download this from github url.

After composer install you will get this dependency in your vendor file.The directory will be that type

projectName/vendor/paypal

Make sure that you include bootstrap.php file in your project’s root index.php file.For autoload all vendor.Like that

Now it’s time to use mpdf in your php project.For use mdf in your php project follow my below code.

Mpdf with PHP and HTML

By using my above code the pdf will generate and download your computer’s download folder.
So this is the using technique of mpdf with php and html.If you need anything more follow mdf official website