关于MathJax,那么具体问题(自动?)保存到Word或PDF [英] Specific issue regarding MathJax, then (auto?) save to word or pdf

查看:2164
本文介绍了关于MathJax,那么具体问题(自动?)保存到Word或PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看,这可能是一个欺骗的问题,并道歉,如果这是...但说实话,我什么都关于这个问题的发现似乎是从2007年,或召唤出对IE6之类的特殊注意事项。

Look, this might be a dupe question, and apologies if it is... but honestly, everything I've found on the subject seems to be from 2007, or calls out special caveats for IE6 and the like.

的设置:
使用数学标记和MathJax呈现在网页中的数学(精加工)的网页。

The setup: Web page using math markup and MathJax to render the math in the web page (working fine).

用户(多个)需要能够向此导出到某种文档的 - 字,PDF等 - 用于分配给期望的是在系统中,其中所述页是谁不允许校对/提供服务。

The user(s) need to be able to export this to some sort of doc - word, PDF, etc - for distribution to proof-readers who are not permitted/desired to be "in the system" where the pages are served.

问题:
到目前为止我已经竭尽所能,以获得最终呈现的产品出来某种DOC的 - 比做一个用户启动浏览器的打印其他 - 显示未渲染标记和不是最终产品。

The issue: Everything I've tried thus far to get the rendered final product out to some sort of doc - OTHER than doing a user-initiated browser-print - shows the unrendered markup and not the final product.

这显然是由于方式MathJax库呈现页面时,它完全可用,在浏览器,因为它只是一个JS脚本包容。没有惊喜出现。

This is obviously due to the way the MathJax library renders the page when it's fully available, in the browser, as it's just a JS script inclusion. No surprises there.

我能得到的关闭的做一个Ajax调用,以呈现页面和发送的HTML的整个BLOB到第三页写出来到光盘上,并与哑剧和内容重新为它服务处置标头MSWORD,把它保存到光盘等,但渲染是不正确的 - presumably由于在POST调用包装起来。这是一个很大的步骤,一个不很-正确的解决方案,以结束了,无论如何。

I can get close by doing an ajax call to a page that renders, and sending that whole blob of html to a third page to write out to disc and re-serve it with mime and content disposition headers for msword, saving it to disc, etc., but the rendering is not correct - presumably due to packaging it up in a POST call. And that's a lot of steps to end up with a not-quite-right solution, anyway.

我猜的答案将是:你不能这样做,至少在没有使用的TeX Live或MIKTEX等庞大的安装中的一个,并与外壳后端做呼吁...但我没有你一定要安装在这些主机的能力。

I'm guessing the answer is going to be "you can't do that", at least not without using one of the HUGE installs of TeX Live or MikTex, etc., and doing it in the back end with shell calls... but I don't have the ability to install on these hosts anyway.

我是坚持与用户做一个打印到PDF解决方案?是否有什么我失踪?

Am I stuck with users doing a print-to-PDF solution? Is there something I'm missing?

谢谢,快乐充实在需要的地方,但我不能成为第一个试图做到这一点。

Thanks, happy to flesh out where needed, but I can't be the first trying to do this.

推荐答案

对于PDF 有几个选项,这主要取决于你想要多少工作摆在

For PDF there are a couple of options and it mostly depends on how much work you want to put in.

快速和肮脏的解决方案可能是 wkhtmltopdf 的,但你必须的指定的JavaScript渲染完成等待时间 - 不理想。

The quick and dirty solution might be wkhtmltopdf, but you'll have to specify a wait time for JavaScript rendering to finish -- not ideal.

PhantomJS 需要稍多的工作,但可以让你听的页面,例如,的这个讨论链接到一个简单的例子。 (有很多基于PhantomJS-工具,有其实。)

PhantomJS requires slightly more work but allows you to listen in on the page, e.g., this discussion links to a simple example. (There are lots of PhantomJS-based tools out there actually.)

另一种方法是使用 MathJax节点是第一pre-过程然后结果传递给wkhtmltopdf(那么你不必等待MathJax)。

Another way would be to first pre-process using MathJax-node and then pass the result to wkhtmltopdf (then you don't have to wait for MathJax).

对于DOC / DOCX 我不认为有什么办法现在。自然的方式是使用MathJax节点产生MATHML,因为Word可以导入MathML了。但Word似乎并没有从HTML导入时支持MathML了。这同样适用于与MathJax节点生成的SVG(但使用SVG你会失去编辑的方程以便可能过高反正的能力)。

For doc/docx I don't think there is any way right now. The natural way would be to use MathJax-node to generate MathML, since Word can import MathML. But Word does not seem to support MathML when imported from HTML. The same holds for generating SVG with MathJax-node (but with SVG you would loose the ability to edit the equations so that might be prohibitive anyway).

Pandoc可能最终帮助。它可以转换显然数学到MS Office格式,请参见演示#30 )。但是,从一个快速测试这似乎并不为HTML的输入工作现在。

Pandoc might eventually help. It can apparently convert mathematics to the MS Office format, see demo #30). But from a quick test this doesn't seem to work for HTML input right now.

这篇关于关于MathJax,那么具体问题(自动?)保存到Word或PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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