in reply to Re: PDF::API2 page margin in thread PDF::API2 page margin
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();
|