in reply to Extract certain pages from a multi page PDF doc help!

Just in case you were looking for an idea on how to make pdftk a bit more user friendly, you could take this as a start. Of course there are all sorts of details to account for, like input file name, extracting a single page, trying to extract an illegal range of pages, etc. etc. etc. But that is why writing a good gui takes some time and effort. :-)
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; my ($page_start,$page_end); $mw->Label(-text => 'Start' )->grid(-row => 0, -column => 0 +); $mw->Entry(-textvariable => \$page_start )->grid(-row => 0, -column + => 1); $mw->Label(-text => 'End' )->grid(-row => 1, -column => 0); $mw->Entry(-textvariable => \$page_end )->grid(-row => 1, -column => 1 +); my $bframe = $mw->Frame(-border => 1)->grid(); my $button = $bframe->Button(-text => 'Ok', -bg => 'hotpink', -command => \&get_pdfs )->grid(); MainLoop; sub get_pdfs{ print "Start $page_start \t\t End $page_end\n"; #untested string concantations, but you should get the idea # system ( pdftk A=100p-inputfile.pdf cat A22-36 output outfile_p22-p +36.pdf ) # system ( "pdftk A=100p-inputfile.pdf cat A.$page_start-$page_end ou +tput outfile_p$page_start-p$page_end.pdf ) print "Done\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Extract certain pages from a multi page PDF doc help!
by Anonymous Monk on Oct 22, 2010 at 14:14 UTC
    I did this one:
    #!/usr/bin/perl -w use strict; use PDF::Extract; my $pdf; $pdf=new PDF::Extract( PDFDoc=>"the.pdf"); $pdf->savePDFExtract(PDFPages=>"1 3", PDFCache=>"directory_to" );