开发者

Converting .rtf to .pdf in Haskell [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improve开发者_StackOverflow中文版d and possibly reopened, visit the help center for guidance. Closed 9 years ago.

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?


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.


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜