Hello, I'm using Apache PDFBox version 2.0.16 to add paging to an existing PDF file. My method is working great, the generated PDF is fine. However, when I open the file with Adobe Acrobat Reader, if I try to close the file, it prompts an alert asking me if I want to save the file even though I haven't edited anything, and the file is not editable at first. I can't manage to understand what's happening, and how to prevent it from prompting saving
My code is the following : private void paging(ByteArrayOutputStream os) throws IOException { PDDocument doc = PDDocument.load(new ByteArrayInputStream(os.toByteArray())); PDFont font = getFont(doc); PDPageTree pages = doc.getDocumentCatalog().getPages(); for (int i = 0; i < pages.getCount(); i++) { PDPage page = pages.get(i); PDPageContentStream contentStream = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, true, false); contentStream.beginText(); contentStream.setFont(font, FONT_SIZE); contentStream.setNonStrokingColor(Color.BLACK); contentStream.newLineAtOffset(page.getCropBox().getWidth() - 40, 15); contentStream.showText((i + 1) + " / " + pages.getCount()); contentStream.endText(); contentStream.close(); } doc.save(os); doc.close(); } *Romain SARRY* *Ingénieur en Développement* *06 29 08 34 02* *13 rue des Teinturiers **69100 Villeurbanne*