[Feature]: Add generatePdfDocumentOutline to print options #4466
Description
Describe the feature/enhancement you need
Chromium now has support for generating an optional document outline as part of the PDF generation process. This works in Edge and Chromium/Chrome via command line. It would be really nice if this was supported via the print options as an optional feature because adding a TOC after the fact is really resource intensive.
Here are docs of the Chromium API which includes that option (although marked as experimental)
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
Also works from the command line:
& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
--headless --generate-pdf-document-outline
--print-to-pdf="c:\temp\test.pdf" "D:\..\HtmlSampleFile-SelfContained.html"
The scenario/use case where you would use this feature
I've created a generic library that wraps the HtmlToPdf printing from the WebView that is headless and can run in non-UI environments. It works great and it would be nice if TOC generation could be integrated natively. As it is I provided that functionality externally but it requires several additional libraries (bloating distribution size) and easily doubles generation overhead as we basically have to intercept the HTML, parse out headers and painfully map them to PDF pages (which can be error prone).
https://github.com/RickStrahl/WestWind.WebView.HtmlToPdf
How important is this request to you?
Impactful. My app's user experience would be significantly compromised without it.
Suggested implementation
No response
What does your app do? Is there a pending deadline for this request?
I have several applications that render HTML and allow printing and output to PDF. Specifcally a markdown editor which allows PDF output from generated HTML text.