PDFBox: how to properly copy annotation from one pdf to another
问题 I am trying to copy annotations from one pdf to another. But copying even 1 annotation DOUBLES the size of outputing pdf file. Please find below simple code sample: PDDocument pdf = PDDocument.load(new File("test1.pdf")); PDDocument pdf2 = PDDocument.load(new File("test/test1.pdf")); List<PDAnnotation> pdfAnnotations1 = pdf.getPage(0).getAnnotations(); List<PDAnnotation> pdfAnnotations2 = pdf2.getPage(0).getAnnotations(); pdfAnnotations1.add(pdfAnnotations2.get(0)); pdf.save("test1.pdf"); If