#!/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( );