pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tory S. Anderson <web...@toryanderson.com>
Subject Re: Adding outline or bookmarks to merge-job
Date Mon, 11 Jan 2016 20:02:48 GMT
Using 2.0. My web app receives a set of user's .docx files, 
converts them to PDFs, and ultimately merges them. All of that is 
done, but now I'm adding outlines/bookmarks. I've worked through 
the "bookmark for every page" example and made that work, but my 
bookmarks obviously need to be a little different. Here's what 
I've got going now:

Input: a map containing a title, the semantic location/category of 
the information, and an input stream representing the PDF.
1. For each item of input, put the title and destination (first 
page of the PDF stream) on a bookmark
2. .appendDocument the PDF on to the MASTER pdf.

I have encountered two problems with this that might be helped by 
some suggestions as to functions/objects that can help me. For 
reference, all the .docx files under consideration are identical. 

Problem 1: Since the destination is set with reference to the 
un-appended document, it is lost in the process of appending. As 
such, the bookmarks are not functional
Problem 2: At some point in this process (not the first or second 
item) something closes the COSStream and I cannot .save the 
result, although I can tell it has the right number of pages. 

What is the better way of handling this process, which would 
correctly deal with meta-data (names of sections) and point each 
bookmark to the right (final) thing? Basically it's a problem of 
merging multi-page pdfs and making bookmarks for each item 

For those who want to take a gander at the Clojure code, find it 

The primary function in question is merge-pdfs-memory2. 

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

View raw message