MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Feature]: Add generatePdfDocumentOutline to print options

Open
#4,466 8 comments 0 reactions 2 assignees View on GitHub

@Lakshmisha-KS is already working on this.

Since Feb 12, 2025.

feature request priority-low tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

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)
image

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.

AB#50281146

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.