HamNRye has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have a large collection of PDF's (about 14,000) and I am trying to get a better grip on their management. These are all generated on the fly from our printing system, and have no Meta info.

The Document description has blank fields for Title, Creator, Keywords, etc...

I would like to be able to place a title in the document to help out our search engines. I have tried the PDFlib (pdflib.com), but it is write only, and to read a PDF requires a $1,000.00 license.

I am currently using xpdf to extract the text, but it will not handle DocInfo. My search of CPAN did not yield particularily lush fruit.

So, If you have any suggestions on setting DocInfo for a PDF from either the command line, or a module, I'm all ears. Any help would be appreciated.

Jason
webmaster@nothing4sale.org

Replies are listed 'Best First'.
Re: PDF Information fields: Modifying
by traveler (Parson) on Jun 21, 2002 at 23:13 UTC
    Here is the code to change the title for a PDF. This should get you pointed in the right direction:
    #!/usr/bin/perl use PDF::API2; $pdf = PDF::API2->open('test.pdf'); #%info = $pdf->info; $font = $pdf->corefont("Times-Roman"); $info{Title} = $font->text( "New Title"); $pdf->info (%info); $pdf->update; $pdf->saveas("newfile.pdf");
    PDF::API2 is on CPAN

    HTH, --traveler

      When trying this code, I get the error:

      Can't call method "out_file" on an undefined value at /apps/PERL5/lib/perl5/site_perl/5.6.1/PDF/API2.pm line 587.

      Any ideas why?

        I suspect the issue is that you don't have a file called test.pdf...

        --traveler