Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Retrieve the PDF file description

by roboticus (Chancellor)
on Dec 23, 2012 at 20:29 UTC ( #1010121=note: print w/ replies, xml ) Need Help??


in reply to Re: Retrieve the PDF file description
in thread Retrieve the PDF file description

That could be due to the fact that PDF doesn't seem to be a widely-used module. If you really want to use that module, then after reading the thread, I'd suggest dumping a PDF that works and compare it to one that doesn't. Perhaps the problem is that one has a different encoding for the tags or some such.

If you don't mind switching to a different module, here's one that gets the information using PDF::API2:

#!/usr/bin/perl use strict; use warnings; use PDF::API2; use Data::Dumper; my $FName = shift // die "Missing filename!"; my $pdf = PDF::API2->open($FName) or die "Can't open PDF file $FName: +$!"; my %pdfinfo = $pdf->info; print "Author is: ", $pdfinfo{Author}, "\n"; print "Title is: ", $pdfinfo{Title}, "\n"; print "\n\nAll info tags:\n", Dumper(\%pdfinfo);

If I run it on the first handy PDF file on my desktop, I get:

Author is: Texas Instruments, Incorporated [SNAS033,D ] Title is: LM4873   Dual 2.1W Audio Amplifier Plus Stereo Headpho +ne Function (Rev. D) All info tags: $VAR1 = { 'ModDate' => 'D:20121201221441-06\'00\'', 'Subject' => 'Data Sheet', 'Creator' => 'TopLeaf 7.6.028', 'Title' => 'LM4873   Dual 2.1W Audio Amplifier Plus Ste +reo Headphone Function (Rev. D)', 'Keywords' => ', SNAS033,SNAS033D', 'CreationDate' => 'D:20121201221441-06\'00\'', 'Producer' => 'iText 2.1.7 by 1T3XT', 'Author' => 'Texas Instruments, Incorporated [SNAS033,D ]' };

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re^2: Retrieve the PDF file description
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-08-01 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls