|
I am using the fillFormFields method to fill the fields on IRS forms with computed values.
When I use Adobe Reader to view the resulting pdf file, the data is properly justified when highlight fields is turned on but when highlight fields is turned off, the data is left justified instead of right justified.
The same is true when I print the pdf, the data that should be right justified within the fields is left justifed.
What do I need to do to preserve the proper field justification behavior?
Thanks for any assistance you can give.
My code follows:
use strict;
use CAM::PDF;
use Data::Dumper;
my $infile = "f1040sd1.1.pdf";
my $outfile = "f1040sd1.1.filled.pdf";
my $doc = CAM::PDF->new( $infile ) || die "$CAM::PDF::errstr\n";
my @fieldIds = $doc->getFormFieldList( );
my %fieldData = ( );
foreach my $fieldId (@fieldIds) {
if ( $fieldId =~ m/(.*?)_(.*?)\(0\)/ ) {
my $p1 = $1;
my $p2 = $2;
$fieldData{$fieldId} = $p2;
}
}
$doc->fillFormFields( %fieldData );
$doc->preserveOrder( );
$doc->cleanoutput( $outfile );
|