什么是用于Ruby on Rails的PDF转换器? [英] What is a good PDF to HTML converter for Ruby on Rails?
问题描述
我试图将编程式PDF转换为HTML。到目前为止,我一直在使用 pdftohtml ,但我们的用户对结果并不满意。
以下是我需要的内容:
-
在Rails上,但任何在Unix上工作的工具都可以工作,因为我可以从命令行调用它。但是,当然,一个好的创业板或插件将是完美的。
-
我更喜欢它是开源的。 b
-
它需要能够处理图像
-
如果有需要放弃图像的选项,那将是很好的选择
-
它需要稳定
-
它需要返回html,其布局接近原始pdf (我试过 pdftohtml ,结果在很多情况下都不是很好)
以下是pdftohtml / xpdf的另外几种选择: b
I'm trying to convert programatically PDF to HTML. So far I've been using pdftohtml but our users are not happy with the results.
Here's what I need :
I'm using Ruby on Rails, but any tool working on Unix would work as I can call it from the command line. But of course a nice gem or plugin would be perfect.
I'd prefer it to be open source
It needs to be able handle images
It would be nice if there was an option to discard images if needed
It needs to be stable
It needs to return html with a layout close to the original pdf (I've tried pdftohtml and the result is not that good in a lot of cases)
Here are a couple more alternatives to pdftohtml/xpdf:
- Adobe has a free online PDF to HTML or text conversion service. It might take a minute or two to get the document back, but I would suspect that this option would give you the best results.
- There is a pdf-reader ruby gem that will give you access to the internals of the PDF file. This would involve some development/extension on your part, but you could use this to parse the PDF file and generate nice-looking HTML. This might be easier than it sounds if you know what type of files your users are converting ahead of times (such as if they are working with standardized forms).
- You may have more options if you use ghostscript (gem found here) to convert the PDF to another format first. The gem can generate images (png, jpg, etc) from a PDF file but you might have the best luck converting it into a PostScript file since there seem to be a zillion "PostScript-to-[insert format here]" converters.
这篇关于什么是用于Ruby on Rails的PDF转换器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!