Hi Sascha,
You need to add an empty Chunk to the new Page like this:

  document.newPage();
  document.add(new Chunk(""));

If you don't, the new page is not added.
Peter

-----Urspr�ngliche Nachricht-----
Von: Sascha Schmidt [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 3. Dezember 2003 14:35
An: [EMAIL PROTECTED]
Betreff: [iText-questions] Merging PDFs with blank pages



Hi! 

I'm merging PDFs with iText and want to insert a blank page if a pdf file
has an odd total number of pages. It's needed for duplex printing...
Unfortunately it seems to me that method document.newPage() doesn't work
properly here?!? 
Here is a snippet of my PDF-Merger; this method is called for each PDF
document: 

  private void append(PdfReader reader) throws BadPdfFormatException, 
      IOException, DocumentException { 
    reader.consolidateNamedDestinations(); 

    if (document == null) { 
      document = new Document(reader.getPageSizeWithRotation(1)); 
      writer = new PdfCopy(document, out); 
      document.open(); 
    } 

    final int n = reader.getNumberOfPages(); 
    for (int i = 0; i < n; ) { 
      writer.addPage(writer.getImportedPage(reader, ++i)); 
    } 

    if (reader.getAcroForm() != null) 
      writer.copyAcroForm(reader); 

    //if (forceEvenPageCount && (n%2 ==1) ){ 
      document.newPage(); 
    //} 

  } 


Can somebody help me please? Thanks in advance. 
Sascha


-------------------------------------------------------
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