Reputation: 680
I have created a PDF using PDF::API2. How can I return the raw PDF?
Example:
my $pdf = PDF::API2->new();
$pdf = PDF::API2->open('./useful_scripts/invoice.pdf');
my $page = $pdf->openpage(1);
my $content = $page->text();
my $font = $pdf->corefont('Helvetica-Bold');
$content->fillcolor('black');
$content->font($font, 11);
$content->translate(170, 785);
$content->text($invoice->ott_invoice_number);
#Finally return raw $pdf
I am aware of the $pdf->saveas()
method, but I don't actually want to save my PDF to a file.
Upvotes: 1
Views: 242
Reputation: 680
IRC #perl-help
answer:
my $raw_pdf = $pdf->stringify();
does the job.
Upvotes: 1