Depending on your PDF you may also have to change the crop box.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Dean Krueger
> Sent: Thursday, September 11, 2008 4:10 PM
> To: iText-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] Enlarging PDF via PDFStamper
>
> Paulo,
> I tried this and it doesnt seem to work. The final PDF is the same
> size as the original, I am no expert, but I dont see where the
> PDFDictionary is tied back to the PdfSamper object. I am using
> ItextSharp, but I did try it in java as well, with the same results.
> Here is what I put together, no doubt I missed something..
>
> Thanks for your time!
> Dean Krueger
>
>
> import java.io.FileOutputStream;
> import java.util.HashMap;
>
> import com.lowagie.text.Element;
> import com.lowagie.text.Image;
> import com.lowagie.text.PageSize;
> import com.lowagie.text.pdf.BaseFont;
> import com.lowagie.text.pdf.PdfContentByte;
> import com.lowagie.text.pdf.PdfReader;
> import com.lowagie.text.pdf.PdfStamper;
> import com.lowagie.text.Rectangle;
> import com.lowagie.text.pdf.PdfRectangle;
> import com.lowagie.text.pdf.PdfDictionary;
> import com.lowagie.text.pdf.PdfName;
>
>
> /**
> * Reads the pages of an existing PDF file, enlarges page
> */
> public class EnlargePDF {
> /**
> * Reads the pages of an existing PDF file, adds pagenumbers and a
> watermark.
> * @param args no arguments needed
> */
> public static void main(String[] args) {
>
> System.out.println("EnlargePDF");
> try {
> PdfReader r = new PdfReader("x4.pdf");
> PdfDictionary p = r.getPageN(1); //do
> it for each page
> Rectangle rect = r.getPageSize(1);
> rect.setTop(rect.getTop() + 36);
> rect.setBottom(rect.getBottom() - 36);
> rect.setLeft(rect.getLeft() - 36);
> rect.setRight(rect.getRight() + 36);
> p.put(PdfName.MEDIABOX, new
> PdfRectangle(rect));
> PdfStamper s = new PdfStamper(r, new
> FileOutputStream("x4_tmp.pdf"));
> s.close();
> }
> catch (Exception de) {
> de.printStackTrace();
> }
>
> }
> }
>
>
> >From: Paulo Soares <psoares <at> glintt.com>
> >Subject: Re: Enlarging PDF via PDFStamper
> >Newsgroups: gmane.comp.java.lib.itext.general
> >Date: 2008-09-10 16:51:48 GMT (21 hours and 32 minutes ago)
> >PdfReader r = new PdfReader(...);
> >PdfDictionary p = r.getPageN(1); //do it for each page
> >Rectangle rect = r.getPageSize(1);
> >rect.setTop(rect.getTop() + 36);
> >rect.setBottom(rect.getBottom() - 36);
> >rect.setLeft(rect.getLeft() - 36);
> >rect.setRight(rect.getRight() + 36);
> >p.put(PdfName.MEDIABOX, new PdfRectangle(rect));
> >PdfStamper s = new PdfStamper(r, ...);
> >s.close();
>
> >Paulo
>
> > -----Original Message-----
> > From: itext-questions-bounces <at> lists.sourceforge.net
> > [mailto:itext-questions-bounces <at> lists.sourceforge.net] On
> > Behalf Of Dean Krueger
> > Sent: Wednesday, September 10, 2008 5:36 PM
> > To: itext-questions <at> lists.sourceforge.net
> > Subject: [iText-questions] Enlarging PDF via PDFStamper
> >
> > Hi.
> > I am trying to add 36pts on all 4 sides of a PDF,
> basically enlarging
> > it. I figured out how to do it with a PdfWriter, but
> because this PDF
> > has PDF/X-4 data in it I need to use a PdfStamper. I cant figure out
> > how to get the PdfStamper data on to a new document, which has the
> > enlarged size. Can anyone show me how to do this?
> >
> > Thanks
> > Dean Krueger
>
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK &
> win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php