jupyter-book
jupyter-book copied to clipboard
Use Playwright for our HTML to PDF generation
Context
Currently, we make it possible to generate PDFs via the HTML using the pyppetteer package. We do that in this module:
https://github.com/executablebooks/jupyter-book/blob/91b52c4e872956cba774088bbb2d29451c000b89/jupyter_book/pdf.py#L34-L71
However, pyppetteer is a little bit difficult to work with, and is not super well-maintained (repo ref). For example, see the collection of caveats we need to include in our docs for this.
In the last few years, playwright has emerged as a very well-maintained and modern framework for web UI testing (and PDF generation). It has implementations and usage across several languages, and great documentation:
- https://playwright.dev/docs/intro
Proposal
We should explore replacing our pyppetteer implementation for PDF generation, and instead use playwright. Ideally the end-result should be cleaner and the performance more reliable / better.
We have a closed PR that implemented parts of this below, linking here in case somebody wishes to use that for inspiration or to pick it back up:
- https://github.com/executablebooks/jupyter-book/pull/1664
Tasks and updates
No response