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

Hello, Have a business card template PDF and I've been trying to figure the best way to get the variable data (i.e. name, address, etc.) into the PDF. Anyone have an easy/easier way or know how to fix what I've got?

What I've done is to populate form fields with CAM::PDF, but the form field formatting (text align right or left) in the newly created PDF file isn't maintained. It gets all jumbled, but if I open in Acrobat and type in the fields, the text returns to how it should be. So if it's supposed to be aligned right, the new file has aligned left. Then I type anything in Acrobat and all is fixed. Problem is the user viewing the file sees a mess.

my $pdf = CAM::PDF->new($file);
$pdf->fillFormFields('name','John Doe');

The other thing is if I change any form field properties in the new PDF file, then it looks the way it should.

Pulling my hair out, any help is much appreciated.

Replies are listed 'Best First'.
Re: populating pdf form fields
by mikelieman (Friar) on Oct 20, 2008 at 19:31 UTC
    I used PDF::Merge, copied the form and output the new text right over it.
Re: populating pdf form fields
by zentara (Cardinal) on Oct 20, 2008 at 19:55 UTC
Re: populating pdf form fields
by dragonchild (Archbishop) on Oct 20, 2008 at 19:37 UTC
    Have you discussed this with the maintainer of CAM::PDF? I've found him to be a very responsive author, unlike others I can think of.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?