The ideal print-to-PDF infrastructure would consist of a HTML-to-PDF service + a bunch of CSS styles. Unfortunately current browsers (which are used internally by pretty much all opensource HTML-to-PDF services) do not implement some of the web standards which are important for a decent PDF experience. Since browser vendors' prioritization is to some extent directed by what web developers are interested in, and there does not seem to be a lot of interest in print styles, it's important to express our interest. It would be also helpful for our internal long-term planning to track the development and implementation of print-related web standards.
The standards that seem most relevant:
* [[https://www.w3.org/TR/css3-page/|CSS Page Based Media Level 3]] - use of `content` property to [[https://www.w3.org/TR/css3-page/#populating-margin-boxes|populate page margin boxes]] + use of [[https://www.w3.org/TR/css3-page/#page-based-counters|counter properties with `@page`]] (together these would allow page numbers)
* [[https://www.w3.org/TR/css-gcpm-3/|CSS Generated Content for Paged Media Module]] - use of [[https://www.w3.org/TR/css-gcpm-3/#target-counter|`target-counter()`]] (together with the above it would allow for page numbers in a table of contents)
Less important but nice to have:
* [[https://drafts.csswg.org/css-regions/|CSS Regions]] (makes it possible to flow content into a series of containers which would make JS-based pagination very easy (cf. [[https://github.com/fiduswriter/pagination.js|fiduswriter/pagination.js]]), so this is an alternative to the above two; but a lot more complicated so less likely to be implemented anytime soon)
* [[https://www.w3.org/TR/css-gcpm-3/|CSS Generated Content for Paged Media Module]] - use of [[https://www.w3.org/TR/css-gcpm-3/#bookmarks|bookmarks]] (the CSS way to create PDF outlines)
* [[https://www.w3.org/TR/css-gcpm-3/|CSS Generated Content for Paged Media Module]] - use of [[https://www.w3.org/TR/css-gcpm-3/#leaders|leaders]] (the ...... thing in tables of content; can be done in other ways with some hacking so not really important)
Other relevant standards:
* [[https://drafts.csswg.org/css-page-floats/|CSS Page Floats]]
* [[https://drafts.csswg.org/css-break/|CSS Fragmentation Module Level 3]]
* [[https://figures.spec.whatwg.org/|CSS Figures]] and [[https://books.spec.whatwg.org/|CSS Books]] (seems to be the WHATWG equivalent of Page Floats and Generated Content for Paged Media)
* [[https://drafts.csswg.org/css-page-template-1/|CSS Pagination Templates Module Level 3]]