- #LINUX PARSE PDFINFO OUTPUT PDF#
- #LINUX PARSE PDFINFO OUTPUT INSTALL#
- #LINUX PARSE PDFINFO OUTPUT DOWNLOAD#
- #LINUX PARSE PDFINFO OUTPUT FREE#
- #LINUX PARSE PDFINFO OUTPUT WINDOWS#
That's why I anycodings_pdf made this question and answered it anycodings_pdf myself.
#LINUX PARSE PDFINFO OUTPUT PDF#
I hope this can help people, because I anycodings_pdf have spent a whole lot of time trying to anycodings_pdf find the solution to this and I have anycodings_pdf seen a lot of questions about PDF anycodings_pdf pagecount in which I didn't find the anycodings_pdf answer I was looking for. I know its not pure PHP, but external anycodings_pdf programs are way better in PDF handling anycodings_pdf (as seen in the question). Of course this command line tool can be anycodings_pdf used in other languages that can parse anycodings_pdf output from an external program, but I anycodings_pdf use it in PHP. Surround with double quotes if file name has spaces
#LINUX PARSE PDFINFO OUTPUT WINDOWS#
$cmd = "C:\\path\\to\\pdfinfo.exe" // Windows There is an easy way of extracting the anycodings_pdf pagecount from the output, here in PHP: // Make a function for convenience It is anycodings_pdf also really fast, even with big anycodings_pdf documents of 200+ MB the response time anycodings_pdf is a just a few seconds or less. I haven't seen a PDF document where it anycodings_pdf returned a false pagecount (yet). Producer: Acrobat Distiller 9.2.0 (Windows) An example of anycodings_pdf data returned by running it on a PDF anycodings_pdf document: Title: test1.pdf One of those files is pdfinfo (or anycodings_pdf pdfinfo.exe for Windows).
#LINUX PARSE PDFINFO OUTPUT DOWNLOAD#
You download a compressed file anycodings_pdf containing several little PDF-related anycodings_pdf programs. It is downloadable for Linux and anycodings_pdf Windows. So, what does work reliable and accurate?Ī simple command line executable called: pdfinfo.
Regular Expressions found by Googling (all linked to SO answers): $content = fread ($stream, filesize($f)) This opens the PDF file in a stream and anycodings_pdf searches for some kind of string, containing anycodings_pdf the pagecount or something similar. Opening a stream and search with a regular expression:
#LINUX PARSE PDFINFO OUTPUT FREE#
It then returns an error:įPDF error: This document (test_1.pdf) anycodings_pdf probably uses a compression technique which anycodings_pdf is not supported by the free parser shipped anycodings_pdf with FPDI.
#LINUX PARSE PDFINFO OUTPUT INSTALL#
Using FPDI (a PHP library)įPDI is easy to use and install (just anycodings_pdf extract files and call a PHP script), BUT anycodings_pdf many of the compression techniques are not anycodings_pdf supported by FPDI. That was with both anycodings_pdf the getNumberImages() and identifyImage() anycodings_pdf methods. Imagick requires a lot of installation, anycodings_pdf apache needs to restart, and when I finally anycodings_pdf had it working, it took amazingly long to anycodings_pdf process (2-3 minutes per document) and it anycodings_pdf always returned 1 page in every document anycodings_pdf (haven't seen a working copy of Imagick so anycodings_pdf far), so I threw it away. Here are some of the answers I found anycodings_pdf insufficient or simply NOT working: Using Imagick (a PHP extension)
anycodings_pdf PDF documents come from many different anycodings_pdf clients, so they aren't generated with the anycodings_pdf same application and/or don't use the same anycodings_pdf compression method. Since I anycodings_pdf work for a graphic printing and reproduction anycodings_pdf company that works a lot with PDFs, the anycodings_pdf number of pages in a document must be anycodings_pdf precisely known before they are processed. Many hours have I searched for a fast and anycodings_pdf easy, but mostly accurate, way to get the anycodings_pdf number of pages in a PDF document.
The solution is the accepted answer below. This question is for referencing and comparing.