diff --git a/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxOutputDevice.java b/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxOutputDevice.java index f4a682481..12eac0fb6 100644 --- a/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxOutputDevice.java +++ b/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxOutputDevice.java @@ -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); }