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

Reply via email to