Perl API2 Font Examples Embedding TrueType Fonts. Finding examples of working with TrueType Fonts in API2 is like pulling teeth. I know I lost a few trying to get the thing to work. Turns out, embedding a TTF into a PDF isn't that difficult. This isn't a tutorial, but it should help some of you out there! SUPPORTED PERL VERSIONS. PDF::API2 will aim to support all major Perl versions that were released in the past six years, plus one, in order to continue working for the life of most long-term-stable (LTS) server distributions.
Active4 years, 4 months ago
Below is complete minimal code required to create a single PDF file using Perl module PDF::API2. The first PDF is created fine. At the start of the attempt to create the second PDF, the process fails at the second instance of line:
with the error,
Can't call method 'new_obj' on an undefined value at C:/Perl64/site/lib/PDF/API2/Basic/PDF/Pages.pm line 92.
Why? More importantly, what change do I have to make to create a second pdf?
Karl
KarlKarl
1,1181 gold badge17 silver badges32 bronze badges
2 Answers
Using
Data::Dumper
after first creating $pdf
reveals a lot of data:
Encore 4.5 5 free download. This is all removed after the call to
saveas
, causing the undefined value
error:
You could recreate
$pdf
:
Warriors game download. but then you'd also need to add all the other method calls (
corefonts
, mediabox
, text
). Easier to put the PDF creation code into a sub:
Then call it twice with relevant arguments.
Full working example:
RobEarl
Perl Pdf Api2 Rotate
RobEarl
7,1666 gold badges29 silver badges48 bronze badges
ShellFish
3,7461 gold badge12 silver badges30 bronze badges
Yum Install Perl-pdf-api2
faceface