C
ccc31807
I've been using PDF::API2 for years without a problem of any kind, but now have a new requirement -- text wrapping. Here's an example:
#from a hashref from a database, name could be NULL
my $name = $hashref->{$key}{name};
my $sentence = '';
$sentence = "Hello, my name is $name." if $name;
#in PDF code
$text->text("Greetings. $sentence Here is some information.");
This works if $name is NULL, because $sentence takes up no space and the end result contains two spaces after the greeting, which isn't a big deal.
However, there's a big difference between 'Ed' and 'Barack Hussein Obama.' The longer names cause the line to run off the right margin.
Is it possible to wrap text in PDF::API2? I've looked and can't see how.
I could write my own wrapping routine, but would rather not.
I also don't want to use another module (maybe CAM:DF) but would rather not, and I haven't looked at the other modules to see if they can wrap text.
Thanks, CC.
#from a hashref from a database, name could be NULL
my $name = $hashref->{$key}{name};
my $sentence = '';
$sentence = "Hello, my name is $name." if $name;
#in PDF code
$text->text("Greetings. $sentence Here is some information.");
This works if $name is NULL, because $sentence takes up no space and the end result contains two spaces after the greeting, which isn't a big deal.
However, there's a big difference between 'Ed' and 'Barack Hussein Obama.' The longer names cause the line to run off the right margin.
Is it possible to wrap text in PDF::API2? I've looked and can't see how.
I could write my own wrapping routine, but would rather not.
I also don't want to use another module (maybe CAM:DF) but would rather not, and I haven't looked at the other modules to see if they can wrap text.
Thanks, CC.