Subject: | fillFormFields() aligment bug + small FIX |
Date: | Thu, 24 Aug 2017 11:04:13 -0500 |
To: | <bug-CAM-PDF [...] rt.cpan.org> |
From: | "Ken Gillett" <ken.gillett [...] wscadc.tzo.com> |
I use CAM::PDF to fill out PDF forms quickly using data from a database, and
I noticed there were some issues with the alignment when using the
fillFormFields() function. The biggest one being it's very limited on which
fonts are supported for the alignment (Courier works for example, but not
Courier Bold). After some investigating, I've noticed the following changes
will help (it's not perfect, but much better in my opinion):
. Line #4444, change to
o my $border = 1;
. Line #4446, change to
o my $ty = $border + 1;
. Lines #4536-4540
o comment out
. Line #4574, change to
o my $width = $stringwidth || $self->getStringWidth($fontmetrics, (substr
$text, 1, (length $text)-2));
Basically, it fixes the borders a bit and also changes the way the
stringwidth is calculated. The stringwidth would calculate the width of the
string with the PDF parentheses included. For example, it would calculate
the length of (100.00) instead of just 100.00. This caused the center &
right alignments to be off.
signature