Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

PDF files

by Anonymous Monk
on Jul 03, 2001 at 23:21 UTC ( [id://93643]=perlquestion: print w/replies, xml ) Need Help??

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

Hey, folks!

Has anyone ever tried to work with PDF files using Perl? What I'd like to do is: given a PDF file, take page N and save it as another PDF file...

Thanks!

Replies are listed 'Best First'.
Re: PDF files
by runrig (Abbot) on Jul 03, 2001 at 23:33 UTC
    Have you looked for PDF on CPAN? Do any of those not do what you want?
Re: PDF files
by Maestro_007 (Hermit) on Jul 04, 2001 at 00:02 UTC
    There was a good post just today, XML2PDF. That post and its responses regarding PDFLib would be a great starting place!

    MM

Re: PDF files
by JojoLinkyBob (Scribe) on Jul 04, 2001 at 04:14 UTC
    Here's a fragment that might help, that might get you started at least:
    $fileheader_printed = 0; sub hash_figs { $figfile = $_[0]; open (fp, $figfile) || die ("Can't open $figfile.\nExiting"); $nodecount=0; $numpages=0; $ignore_text = 0; #Used to exclude page footer while (<fp>) { if (/^%!PS-Adobe/) #Start of Page Marker { if (++$numpages == 2) #Header is first element in list { if (!$fileheader_printed) { print @linelist; #print header $fileheader_printed = 1; } } else { if ("insert reg expr here") { print @linelist; #Print Figure } if ($nodecount++%80==0) { print STDERR "\n "; } } $currfig="junk"; @linelist = (); } elsif(m/^%%Title:/) { $currfig = uc $1; } elsif (/\[100 0 0 \-100 0 0\]\/Times\-Roman MF/) #Ignore Page Foot +er { $ignore_text = 1; } elsif (/Preamble/) #Ignore Page Footer { $ignore_text = 0; } if (not $ignore_text) { push (@linelist, $_); } } }
    Desert coder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://93643]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found