Skip to content

Commit

Permalink
Try to preserve existing outlines if the document had already one.
Browse files Browse the repository at this point in the history
(cherry picked from commit 93bc44a)
  • Loading branch information
rototor committed May 22, 2018
1 parent ce60188 commit 3a03faf
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,11 @@ private void writeOutline(RenderingContext c, Box root) {
if (_bookmarks.size() > 0) {
// TODO: .setViewerPreferences(PdfWriter.PageModeUseOutlines);

PDDocumentOutline outline = new PDDocumentOutline();
_writer.getDocumentCatalog().setDocumentOutline( outline );
PDDocumentOutline outline = _writer.getDocumentCatalog().getDocumentOutline();
if (outline == null) {
outline = new PDDocumentOutline();
_writer.getDocumentCatalog().setDocumentOutline(outline);
}

writeBookmarks(c, root, outline, _bookmarks);
}
Expand Down

0 comments on commit 3a03faf

Please sign in to comment.