Re: editing pdf files with perl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

> <snip>
> > So why does this not qualify as an appropriate question for this group?
> > It certainly looks like a miscellaneous perl question to me...

O.K. Here's a Perl script that uses Pdftk to merge an FDF file into a PDF
file, which could provide a command-line solution for the OP (Tested on this
Win32 workstation).

# usage - ..\bin\perl inpdf=sam_hdrftr.pdf
infdf=sample_was_data.fdf outpdf=sam_hdrftr_filled.pdf
# note - all files used in this example reside in c:\indigoperl\tmp on this
Win32 workstation

use strict;
use warnings;
use CGI qw(:param);
my $inpdf  = param('inpdf');
my $infdf  = param('infdf');
my $outpdf = param('outpdf');

#Example 4 - fill a PDF with the data in an FDF file
system('pdftk.exe', $inpdf, 'fill_form', $infdf, 'output', $outpdf);

See the documentation for Pdftk,, for any questions
on command syntax for Pdftk.


> >Plus I
> > want to know the answer but I'm lazy enough not to go to comp.text.pdf
> > to get it. :-) Thanks. - pikus

I hope you looked at the examples and documentation for Pdftk, where you
might have learned some of the resons why you shouldn't just routinely edit
a PDF file, even though it may "look" like a plain text file.

Bill Segraves

Re: editing pdf files with perl


I wish to thank everyone who took time out to read and answer my
doubt(s) here. Ultimately I used PDF::Reuse which served the purpose.

Bill, I visited your website and its a very useful place for people
working in the PDF-Perl Domain.

Thanks again. It has been a learning experience here. :o)

Aditya Kumar

Site Timeline