How does Chrome render PDF files from HTML perfectly?

I want to emulate some of the latex functions in HTML and render to PDF files. So far, I have used the Print Save to PDF feature of Chrome very closely.

I tried wkhtmltopdf (not big), PhantomJS (OK), Safari (pretty good) and Firefox (almost there), but no one is close to Chrome quality.

There are many details that only Chrome becomes right, even if most of the options start webkit, for example. font, rendering soft hyphens, mathematical symbols with MathJax and specifying page parameters such as A4 and borderless, etc.

What is Chrome’s secret sauce and how to get it to automate this process?

Thank you very much!

+6
source share
2 answers

A fairly complete answer was found here fooobar.com/questions/451393 / ...

PDFium is a PDF viewer used in Chrome. The print component is a combination of Blink and Skia.

These guys are working on a reorganization of print components that could lead to a possible API / automation for generating PDFs.

+5
source

From the source code , it looks like they are using PDFium , which comes from Foxit Reader . Either the PDFium code or the Foxit PDF SDK can help automate.

0
source

Source: https://habr.com/ru/post/984874/


All Articles