Re: Cant change mediabox on existing PDF

"duder60" <duder60-/[email protected]> Mon, 15 Oct 2007 18:38:55 -0000
Newsgroups gmane.comp.lang.perl.modules.pdfapi2
Message-ID <[email protected]>
Does this method work on an entire page, or just on elements within a
page?

Thanks again!

--- In [email protected], Gert Blekkenhorst
<gblekkenhorst@...> wrote:
>
> Hi,
>  
> Clipping and moving it around did the trick for us.
>  
>  
>  
> #
> my @box=($X0, $Y0, $W, $H) ;
>  
> #
> $gfx->rect(@box) ;
> 
> #
>  
> gfx->transform(
> -translate => [$BoundingBox[0]-$minX,
$BoundingBox[3]-$maxY-($BoundingBox[3]-$a4H)],
> ) ;
> 
> #
> $gfx->clip ;
> 
>  
> 
> 
> 
> 
> __________________________________________________
> 
> Van duder60 <duder60@...>
> Verstuurd vr 12-10-2007 16:51
> Aan [email protected]
> Onderwerp [perl-text-pdf-modules] Cant change mediabox on existing PDF
> 
> 
> 
> 
> I have a bunch of PDFs wirh crop and registration marks on them. I
> want to crop them, so that the marks are gone forever. I can change
> the cropbox, but I can't get the mediabox to change.
> 
> Maybe I am doing things in the wrong order?
> 
> Here is my code:
> 
> use PDF::API2;
> 
> use constant in => 1/72;
> 
> $pdf_path = "c:/cf/utils/old.pdf";
> $new_pdf_path = "c:/cf/utils/new.pdf";
> 
> $pdf = PDF::API2->new;
> $import = PDF::API2->open("$pdf_path");
> $pdf->importpage($import);
> $pdf->mediabox(.5/in, .5/in, 6/in, 9/in);
> $pdf->cropbox(.5/in, .5/in, 6/in, 9/in);
> $pdf->saveas("$new_pdf_path");
> 
> Thanks!
> 
> 
>  ******************* BELANGRIJK ! *******************************
> 
> De Triple P eSafe virusscanner heeft gevaarlijke inhoud
> en/of virus in dit mailtje gevonden en verwijderd.
> 
> Bij vragen contact opnemen met de Servicedesk.
> 
> **********************************************************************
> 
> \HTML Active Content:   Found invalid IMG Tag, Found Web-beacon,
Object Removed: 1 'img'
>