Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Chrome render PDFs from HTML so well?

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!

like image 645
Dan0 Avatar asked Apr 08 '15 23:04

Dan0


People also ask

What PDF engine does Chrome use?

2 Answers. Show activity on this post. PDFium is the PDF viewer used in Chrome. The printing component is a combination of Blink and Skia.

Is Chrome good for PDF viewer?

#1 PDF Viewer (Chrome)PDF Viewer is one of the best PDF reader extensions for Chrome. It allows you to open/view/edit the PDF file in a readable format. PDF viewer uses HTML5 for displaying the PDF file directly on the web browser.

Why are PDFs so laggy in Chrome?

Your web cache might be the reason Chrome has difficulties rendering PDFs, especially if the cache is corrupted. Here is how you can delete all locally-cached data: Press Ctrl + Shift + Delete to open Chrome's Clear browsing data window. Select the Basic tab.

How do I stop Chrome from converting PDF to HTML?

It's a quick fix if you follow these steps: Step 1: Open Chrome and type "about:plugins" into the omnibox at the top. Step 2: Scroll down and find Chrome PDF Viewer. Step 3: Click the "Disable" link to prevent PDFs from loading within Chrome.


1 Answers

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.

like image 73
Dan0 Avatar answered Oct 27 '22 07:10

Dan0