vendredi 22 mars 2019

Laravel / PHP: How to count number of pages in pdf file?

I am building a web application that merges uploaded pdf files belonging to an Eloquent object using laravel-pdfmerger. In case an object doesn't have a related pdf file, I will create a new file using laravel-dompdf. Everything works fine.

Now I want to add an option for double pages. Meaning, everytime the uploaded file has an odd number of pages, I will add a blank page.

What is the smartest way to count the number of pages of a pdf file?

I think it might be possible with fpdi. However, I don't want to create a new fpdi object for every file just to count the number of pages. Any better ideas?

Thank you in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire