Chrome headless has an experimental parameter to generate a PDF outline (bookmarks). See https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
generateDocumentOutline boolean Whether or not to embed the document outline into the PDF. Experimental
But, there are open issues about it, such as https://issues.chromium.org/issues/383706655 . So:
- We need to check how it works with the way paged.js is splitting the content into print pages.
- We shouldn't enable the outline by default as long as it is experimental. I'd rather expose a configuration on the PDF Export Options modal, but only when the headless Chrome PDF generator is used.
- We need to run all PDF export tests with this option enabled to see if we have failures
- We need to add an automated test specifically for checking the produced outline / bookmarks. For this we need to see how to read the bookmarks from the generated PDF using PDFBox.
- We need to check if the produced PDF with outline is still crashing Adobe Reader (we might have to use a newer version of headless Chrome Docker image).
This fix for the outline entries pointing to themselves as their own parent (leading to issues with Reader) should be in 136.0.7067.0 and later.
|