5

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

By using PDFlib or pdftet.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Anil
  • 3,912
  • 5
  • 35
  • 46

1 Answers1

9

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";
shank
  • 484
  • 2
  • 5