Is there any Perl script to read multiple PDF files and get the number of pages in it?
By using PDFlib or pdftet.
In Adobe Acrobat Pro, go to file > create PDF > merge files into a single PDF. Then add files and select the files you want. Click combine, and see how many pages are in the final PDF.
1 Correct answer In terms of the question of how many pages a single PDF file can contain, there is no set limit.
php function count_pdf_pages($pdfname) { $pdftext = file_get_contents($pdfname); $num = preg_match_all("/\/Page\W/", $pdftext, $dummy); return $num; } $pdfname = 'example. pdf'; // Put your PDF path $pages = count_pdf_pages($pdfname); echo $pages; ?>
How about just using Perl with the PDF::API2?
#!/usr/bin/perl
use PDF::API2;
foreach $doc (@ARGV)
{
$pdf = PDF::API2->open($doc);
$pages = $pdf->pages;
$totalpages += $pages;
print "$doc contains $pages pages\n";
}
print "Total pages of pdf pages = $totalpages\n";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With