Closed cupsman closed 2 years ago
After working on this longer I found there was a crop box in the page and once I cleared that I was able to get the page size correctly.
my @cropb = $gpage->get_cropbox(); print "... Crop Box @cropb ... \n"; ... Crop Box 0 0 326.05 85.05 ...
$gpage->cropbox(0); print "... Crop Box @cropb ... \n";
I want to modify this pdf so it's 86 X 327pts and rotation to 270. The rotation works but I can't get it to 86 X 237pts
I need it to be: Page size: 86 x 327 pts Page rot: 270
Here's the current size of the pdf with pdfinfo: Page size: 326.05 x 85.05 pts Page rot: 0 File size: 10256 bytes Optimized: no PDF version: 1.4
I'm unable to get the document to 86 X 327 pts and tried with various settings. It changes it but the 2nd coordinate never gets above 85 pts.
!/usr/bin/perl
use strict; use PDF::API2; my $gpage;
Open an existing PDF file
my $pdf = PDF::API2->open('/tdata/onetest.pdf');
my $page = $pdf->page();
$gpage = $pdf->openpage(1);
Get page info
$gpage->rotate(270); my @rectangle = $gpage->page_size(); print "...Page Size: @rectangle..\n";
set Media Size
$gpage->boundaries(media => [0, 0, 6 72, 4 72]);
show new settings
my @rectangle = $gpage->page_size(); print "...Page Size: @rectangle..\n";
my @box = $gpage->get_mediabox(); print "... Media Box: @box ... \n";
$gpage->mediabox(86,327); my @box = $gpage->get_mediabox();
print "... Media Box: @box ... \n";
$pdf->saveas("test.pdf");
Output of the sscript ...Page Size: 0 0 612 792.. ...Page Size: 0 0 612 792.. ... Media Box: 0 0 432 288 ... ... Media Box: 0 0 86 327 ...
pdfinfo of the files shows: Page size: 86 x 85.05 pts Page rot: 270 File size: 11166 bytes Optimized: no PDF version: 1.4
######################################################## PDF-API2-2.043 CPAN