I could look at it but I'd need the PDF. Please upload to a sharehoster.

Tilman

Am 27.12.2018 um 22:55 schrieb Ilya Sterin:
I'm trying to break a PDF down into individual pages.  Although it
functionally works, the pdf for each page ends up being almost the size of
the original PDF (250MB).  I've seen some references in deleting
annotations which might include links to other pages/resources.  I've tried
the below, but no luck.  Can someone let me know what I'm doing wrong?

(Below code is in Kotlin).  I've also tried using addPage vs. importPage,
since the later creates a deep copy.  Same result.

doc.pages.forEachIndexed { idx: Int, p: PDPage ->
             val newDoc = PDDocument()
             val newPage = newDoc.importPage(p)
             newPage.annotations = null
             newPage.resources = null
             newDoc.save("/tmp/$idx.pdf")
             newDoc.close()
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to