diff --git a/src/main/java/sirius/web/templates/pdf/TagliatellePDFContentHandler.java b/src/main/java/sirius/web/templates/pdf/TagliatellePDFContentHandler.java index db75dceba..a96d3433a 100644 --- a/src/main/java/sirius/web/templates/pdf/TagliatellePDFContentHandler.java +++ b/src/main/java/sirius/web/templates/pdf/TagliatellePDFContentHandler.java @@ -78,6 +78,13 @@ public boolean generate(Generator generator, OutputStream out) throws Exception private String cleanHtml(String html) { Document document = Jsoup.parse(html); + // the parser is very strict in terms of what elements are accepted within the element, and it does not + // know about additional valid elements like that are valid for flying saucer; we need to move them + // back from the to the element + document.select("body > bookmarks").forEach(bookmarks -> { + document.head().appendChild(bookmarks); + }); + // in theory, the following two lines should be possible with a single CSS selector; however, in practice, Jsoup // does not select the style elements correctly when attempting that document.select("script").remove();