ps04 has asked for the wisdom of the Perl Monks concerning the following question:

I need to get the existing margins(left, right, top, bottom) on a page of pdf file in perl, here is the code to get the dimension of padf page.

use CAM::PDF; my $pdf = CAM::PDF->new('test2.pdf'); my $num_page=$pdf->numPages(); print "Total Pages : $num_page\n"; my ($x,$y,$width,$height)=$pdf->getPageDimensions(2); print "Dimension of PDF File : $width x $height px \n";

Replies are listed 'Best First'.
Re: Get the existing margin on a pdf page
by Anonymous Monk on Aug 21, 2013 at 09:56 UTC
      Hey Thanks for the reply but, That will give the size of media/page not the margin of text present on the pdf page.

        Hey Thanks for the reply but, That will give the size of media/page not the margin of text present on the pdf page.

        The author of CAM::PDF answered the question how to move page to the right, by manipulating mediabox -- thats like increasing the margin -- so it is the margin of the page

        But I really don't use CAM::PDF much