How can I get the number of pages in a PDF file in Perl?

Is there any Perl script to read multiple PDFs and get the number of pages in it?

Using PDFlib or pdftet.

+5
source share
1 answer

How to just use Perl with 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";
+8
source

All Articles