什么是用于Ruby on Rails的PDF转换器? [英] What is a good PDF to HTML converter for Ruby on Rails?

查看:194
本文介绍了什么是用于Ruby on Rails的PDF转换器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将编程式PDF转换为HTML。到目前为止,我一直在使用 pdftohtml ,但我们的用户对结果并不满意。



以下是我需要的内容:




  • 在Rails上,但任何在Unix上工作的工具都可以工作,因为我可以从命令行调用它。但是,当然,一个好的创业板或插件将是完美的。


  • 我更喜欢它是开源的。 b

  • 它需要能够处理图像


  • 如果有需要放弃图像的选项,那将是很好的选择


  • 它需要稳定


  • 它需要返回html,其布局接近原始pdf (我试过 pdftohtml ,结果在很多情况下都不是很好)



解决方案

以下是pdftohtml / xpdf的另外几种选择: b


  • Adob​​e提供免费在线PDF格式的HTML或文本转换服务。可能需要一两分钟的时间才能收回文档,但我会怀疑这个选项会给您带来最好的结果。 有一个 pdf-reader 可以让你访问PDF文件内部的红宝石。这将涉及到您的部分开发/扩展,但您可以使用它来解析PDF文件并生成漂亮的HTML。如果您知道用户在提前转换的文件类型(比如他们是否使用标准化表单),这可能比听起来容易。

  • 如果您有更多选项,您使用 ghostscript gem 在这里找到)将PDF转换为另一种格式。 gem可以从PDF文件生成图像(png,jpg等),但是你可能最好将它转换成PostScript文件,因为似乎有数十亿个PostScript-to [insert format here]转换器。 / li>

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屋!

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