Chrome如何很好地呈现HTML格式的PDF? [英] How does Chrome render PDFs from HTML so well?

查看:249
本文介绍了Chrome如何很好地呈现HTML格式的PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在HTML中模拟Latex的某些功能,并将其呈现为PDF.到目前为止,我已经非常接近使用Chrome的保存为PDF"打印功能.

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.

我已经尝试 wkhtmltopdf (不太好),

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

许多细节只有Chrome才能正确使用,即使大多数选项都在webkit之外运行,例如字体渲染软连字符,使用MathJax的数学符号以及指定页面选项(例如A4和marginless等).

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.

Chrome的秘密调味料"是什么,我如何掌握它以实现此过程的自动化?

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

非常感谢!

推荐答案

在这里 https://stackoverflow找到了一个相当全面的答案. com/a/28096322/1816242

PDFium是Chrome中使用的PDF 查看器. 打印组件是眨眼和Skia的组合.

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

这些人正在努力重构那些最终可能会导致API/自动化生成PDF.

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

这篇关于Chrome如何很好地呈现HTML格式的PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆