Tilman, thanks for the reply. I replied to you on stackoverflow, but thought I'd add here as well, in case someone else has the same problem and searches the archive.
I figured this out. I had to remove the PDThreadBead (setThreadBeads) on each page after importPage and before saving it. I went through the process of elimination here. Page looks great. I'm not sure what a thread bead is (can't seem to find it anywhere on the web) and class docs don't help. Thanks! On Fri, Dec 28, 2018 at 12:53 AM Tilman Hausherr <thaush...@t-online.de> wrote: > 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 > >