in reply to PDF::API2 page margin

The CropBox defines the region to which the page contents are to be clipped.
$pdf->cropbox $name $pdf->cropbox $w, $h $pdf->cropbox $llx, $lly, $urx, $ury
Sets the global cropbox.

Replies are listed 'Best First'.
Re^2: PDF::API2 page margin
by shibu_pu (Acolyte) on Apr 18, 2009 at 07:03 UTC
    I tried cropbox. But I am not getting the pdf as my requirement. I am putting an image on the pdf's 1st page. The image is of size 612 x 792. On the pdf, I need a margin of 50 px on all the top, bottom, left and right. When I tried cropbox instead of mediabox, its the same result. #!/usr/bin/perl use CGI; use PDF::API2; my $q = new CGI; my $pdf = PDF::API2->new(); print $q->header( -type => 'application/x-pdf', -attachment => "test.pdf" ); my $page = $pdf->page; $page->mediabox(612, 792); my $gfx = $page->gfx; my $image = $pdf->image_jpeg("test.jpg"); $gfx->image($image); print $pdf->stringify; $pdf->end();