0
for (Integer page : pages) {
                String outFile = out + "_" + page;
                try {
                    int rotation = getRotation(reader, page);
                    OutputStream outputStream = new FileOutputStream(outFile);
                    document = createDocument(reader, page, hasHeader);
                    writer = PdfWriter.getInstance(document, outputStream);
                    document.open();
                PdfImportedPage p = writer.getImportedPage(reader, page);
                Image image = Image.getInstance(p);
                addImageToPdf(rotation, document, image);

                    file.add(FileUtilities.getFile(outFile));           
                    
                }

This code is working fine but output pdf does not have the annotation content it automatically get removed so is there any solution to fix it we are using itext 2.1.7 version

  • Consider using `PdfCopy` instead of `PdfWriter`, see [this answer](https://stackoverflow.com/a/15945467/1729265). – mkl Oct 07 '22 at 16:06
  • can you please share the code snippet what change I need to do – Subharoop Ghosh Oct 07 '22 at 16:57
  • Can you first describe what you exactly want to do? If you just want to copy a PDF then do a file copy - but this can't be all - could it? So you want to concatenate two PDFs which can contain form fields? – Lonzak Oct 10 '22 at 06:42

0 Answers0