在 Haskell 中将 .rtf 转换为 .pdf

发布于 2024-09-14 06:55:45 字数 68 浏览 3 评论 0原文

我有一个 .rtf 文档(带有图像,不仅仅是文本),有哪些 haskell 库可以帮助我完成任务,或者它比看起来容易得多?

I have a .rtf document (with an image, it's not just text), what haskell libraries are there out there to help me in my quest, or is it way easier than it appears?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心不设防 2024-09-21 06:55:45

几年前,我为 RTF 的一个非常有限且专门的子集编写了一个解析器(用 Perl),即使那也是一个巨大的项目。如果你想用 Haskell 编写一个通用的 RTF 解析器,那就太好了;但如果您需要完成工作,我建议使用现有产品。

除了其他人建议的 MS Word 和 Web 服务之外,这里还有一些其他的开源可能性:

  • OpenOffice.Org有一个很好的跨平台 RTF 解析器,尽管可能需要一些工作才能让它在没有人工干预的情况下运行。

  • GNU UnRtf

  • rtfreader,微软参考解析器的 Unix 端口。

  • rtf2latex2e

  • rtf2html

  • 早期的 Unix 的 rtf2tex、rtf2latex、rtf2text 和 rtf2troff 1990 年代的仍然可用,它们甚至可能仍然可以在现代系统上运行。

除了最后一个之外的所有内容都可以在 MacPorts 上使用。检查您本地的 Linux 发行版是否可用。请点击上面的链接查看以上哪些内容适用于 Windows。

以上所有内容都是用 C 语言编写的,因此可以使用 FFI 创建到它们的 Haskell 绑定,但难度不同。我认为唯一真正困难的是 OpenOffice.Org。

Some years ago, I wrote a parser (in Perl) for a very limited and specialized subset of RTF, and even that was a huge project. It would be great if you want to write a general RTF parser in Haskell; but if you need to get work done, I recommend using an existing product.

Besides MS Word and web services suggested by others, here are a few other open source possibilities:

  • OpenOffice.Org has a good cross-platform RTF parser, though it might take some work to get it to run without human intervention.

  • GNU UnRtf

  • rtfreader, a port to Unix of Microsoft's reference parser.

  • rtf2latex2e

  • rtf2html

  • rtf2tex, rtf2latex, rtf2text, and rtf2troff for Unix from the early 1990's are still available, they might even still work on modern systems.

All except the last are available on MacPorts. Check your local Linux distribution for availability there. Follow the above links to see which of the above are available for Windows.

All of the above are in C, so it's possible to create Haskell bindings to them using FFI, with varying degrees of difficulty. The only one which I would expect to be really hard is OpenOffice.Org.

在你怀里撒娇 2024-09-21 06:55:45

调用 Web 服务来完成诸如 PDF 转换器服务。它支持 RTF。

我曾研究过这个产品,所以显然我有偏见。不过它的效果非常好,很多用户都很满意。

Call a web service to do the work such as the PDF Converter Services. It supports RTF.

I worked on this product so obviously I am biased. It works very well though, lots of happy users.

画中仙 2024-09-21 06:55:45

我要使用的第一个工具是 pandoc,但是,它看起来只能编写 . rtf,不解析它。同样, txt2rtf 支持写入 .rtf,而不是读取它。

在pdf方面,HPDF支持生成pdf,并且HsHaruPDF 对阅读 pdf 有一些支持。 line2pdf 可以从ascii输入生成pdf。

是否可以将 .rtf 转换为 pandoc 可以识别的形式?

The first tool I would turn to is pandoc, however, it looks like it can only write .rtf, not parse it. Similarly txt2rtf supports writing .rtf, not reading it.

On the pdf side, HPDF has support for generating pdfs, and HsHaruPDF has some support for reading pdfs. line2pdf can generate pdf from ascii input.

Is it possible to convert the .rtf into a form pandoc can recognize?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文