ndnalibi has asked for the wisdom of the Perl Monks concerning the following question:
This currently creates a 4 page pdf document (the L is missing?) and the imgs array png's are excessively large. I am having a very difficult time finding in depth documentation on this module. Any suggestions or pointers in regards to module usage would be appreciated - and I'm in no way opposed to using a different approach, although HTML::HTMLDoc would not install on my system -seems like it has some compatibility issues with my kernel 2.6.24 since this was listed in all of the "failed" installs Thanks, Bill#!/usr/bin/perl # process_pdf.cgi use PDF::API2; my $pdf = PDF::API2->new(-file => "font_test.pdf"); $pdf->mediabox(647,435); $pdf->trimbox(9,9,629,417); my $page = $pdf->page; my $fnt = $pdf->corefont('Arial',-encode => 'latin1'); my $jpeg = $pdf->image_jpeg('../html/font_test/Beach/background.jpg'); @imgs=( $pdf->image_png('../html/font_test/Beach/B.png'), $pdf->image_png('../html/font_test/Beach/I.png'), $pdf->image_png('../html/font_test/Beach/L.png')); my $txt = $page->text; $txt->textstart; $txt->font($fnt, 12); $txt->translate(200,100); $txt->text("Bill OConnell"); $txt->translate(200,120); $txt->text("Stay Late!"); $txt->translate(200,140); $txt->text("Work hard!"); $txt->textend; foreach my $img (@imgs) { $page=$pdf->page; $page->mediabox($img->width,$img->height); $gfx=$page->gfx; $gfx->image($img,0,0,1); } $page->mediabox($jpeg->width,$jpeg->height); $gfx=$page->gfx; $gfx->image($jpeg,0,0,1); $pdf->save; $pdf->end( );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PDF::API2 question in images
by jds17 (Pilgrim) on Jul 01, 2008 at 20:55 UTC |