Skip to content

Commit

Permalink
Merge pull request #1462 from scireum/feature/jvo/OX-10783-PDF-Bookmarks
Browse files Browse the repository at this point in the history
PDF Bookmark Support
  • Loading branch information
jakobvogel authored Sep 16, 2024
2 parents 2dfc2f7 + 0cb2925 commit 03581c9
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <head> element, and it does not
// know about additional valid elements like <bookmarks> that are valid for flying saucer; we need to move them
// back from the <body> to the <head> 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();
Expand Down

0 comments on commit 03581c9

Please sign in to comment.