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

Reply via email to