That code changes the first page, you need a loop to chage all the pages.
After that you have a new pdf. To replace the old pdf delete it and rename
the new one.
Best Regards,
Paulo Soares
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, November 06, 2003 18:07
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] changing page size of a existing pdf file
> ...
>
> Hi,now the new LEGAL page is inside the baosDocumentPDF. To
> put the baosDocumentPDF in the same file of PdfReader, am I supposed to
> take
> getWriter of PdfSampler and manipulate it ? I remember you, I want to
> change
> the page size of a existing pdf file. Do you have example code that I can
>
> refered to ? I never done that before and I know that you're busy.
>
> public void changerPageSizePourLegal(String newFile, Log log)
> {
> ByteArrayOutputStream baosDocumentPDF = new ByteArrayOutputStream();
> PdfContentByte pdfcbContenuFichierPDF;
> PdfWriter writer;
> Document document = new Document();
>
> int intNombrePageDocumentPDF;
> try
> {
> PdfReader reader = new PdfReader(newFile);
> PdfDictionary dic = reader.getPageN(1);
> dic.put(PdfName.CROPBOX, new PdfArray(new float[]{0, 0,
> PageSize.LEGAL.width(), PageSize.LEGAL.height()}));
> dic.put(PdfName.MEDIABOX, new PdfArray(new float[]{0, 0,
> PageSize.LEGAL.width(), PageSize.LEGAL.height()}));
> PdfStamper stamper = new PdfStamper(reader,baosDocumentPDF);
> stamper.close();
> }
> catch(Exception e) {
> System.out.println(e.getMessage());
> }
> }
>
> Thank's R�mi
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions