10

I'm looking to emulate some of Latex's features in HTML and render to PDFs. So far, I've come very close using Chrome's "save to PDF" print feature.

I've tried wkhtmltopdf (not great), PhantomJS (OK), Safari (pretty good) and Firefox (almost there) but none come close to Chrome's quality.

There are a lot of details that only Chrome gets right, even though most options run off webkit e.g. font rendering soft-hyphens, math symbols with MathJax and specifying page options like A4 and marginless etc.

What is Chrome's "secret sauce" and how can I get hold of it to automate this process?

Many thanks!

Dan0
  • 459
  • 3
  • 16

2 Answers2

10

A fairly comprehensive answer was found here https://stackoverflow.com/a/28096322/1816242

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

These guys are working on refactoring the printing components which could lead to an eventual API / automation for PDF generation.

Community
  • 1
  • 1
Dan0
  • 459
  • 3
  • 16
0

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

Robert Calhoun
  • 4,823
  • 1
  • 38
  • 34
  • Thanks Robert, I actually found an even more comprehensive answer already on stackoverflow by searching for PDFium from your answer. – Dan0 Apr 09 '15 at 00:22