You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Tory S. Anderson" <we...@toryanderson.com> on 2016/01/11 21:02:48 UTC
Re: Adding outline or bookmarks to merge-job
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
appropriately.
For those who want to take a gander at the Clojure code, find it
here:
https://gist.github.com/WorldsEndless/fcc84865b52cb6520c65
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
Re: Adding outline or bookmarks to merge-job
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 11.01.2016 um 21:02 schrieb Tory S. Anderson:
> 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 appropriately.
>
> For those who want to take a gander at the Clojure code, find it here:
> https://gist.github.com/WorldsEndless/fcc84865b52cb6520c65
>
> The primary function in question is merge-pdfs-memory2.
Sorry, the last time I coded in lisp was 30 years ago. It was a lot of
fun, but it needed a special type of thinking that won't come back right
now. Please create the shortest possible java code that shows the
"problem 2" you're having, and for "problem 1" please upload the two
files that you're merging and where the bookmarks are lost.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org