我正在尝试使用 wkhtmltopdf 下载费曼讲座。这是我使用的命令行:
wkhtmltopdf.exe http://www.feynmanlectures.caltech.edu/I_44.html --javascript-delay 20000 --no-stop-slow-scripts ./out/I_44.pdf
如何放大渲染的方程?
在 this topic建议的解决方案(据我了解)是添加
MathJax.Hub.Config({
CommonHTML: {
minScaleAdjust: 100,
}
});
到 HTML。
但是,当然,下载 HTML 文件并在将其传递给 wkhtmltopdf 之前对其进行修改会太麻烦。如果可能的话,我更喜欢更简单的解决方案。
最佳答案
尝试使用
wkhtmltopdf.exe http://www.feynmanlectures.caltech.edu/I_44.html --run-script 'MathJax.Hub.Config({"HTML-CSS": {scale: 200}}); MathJax.Hub.Queue(["Rerender", MathJax.Hub], function () {window.status="finished"})' --window-status finished --no-stop-slow-scripts ./out/I_44.pdf
这将设置数学的缩放因子并以该大小重新渲染它。它还使用 window.status
变量将页面捕获与 MathJax 同步,以便在 MathJax 完成后立即进行捕获(而不是等待任意延迟)。
关于render - wkhtmltopdf 和 MathJax : equations are rendered too small,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51479907/