in reply to PDF mod suggestions
(Code is untested but worked in my head. There shouldn't be much wrong with it. AFAIK, PDF::API2 will automatically embed any fonts it needs -- so long as it can find them)use PDF::API2; my $newpdf = new PDF::API2; my $oldpdf = PDF::API2->open($filename); for my $pg (1 .. $oldpdf->pages) { my $img = $pdf->pdfimageobj( $oldpdf, $pg ); my $page = $pdfnew->page(); $page->mediabox( 6 * 72, 9 * 72); # There's 72 postscript points in + an inch my $gfx = $page->gfx; $gfx->pdfimage( $img, 0.5 * 72, # half inch from the left 0.5 * 72, # half inch from the bottom 5 / 8.5, # x scale = new width / old width 8 / 11 # y scale = new height / old height ); } $pdf->saveas($newfilename); $pdf->end();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PDF mod suggestions
by dpavlin (Friar) on Jun 25, 2004 at 00:05 UTC | |
by BigLug (Chaplain) on Jun 25, 2004 at 03:46 UTC | |
by dpavlin (Friar) on Jun 25, 2004 at 16:27 UTC |