是的,iTextSharp 无法将 RTF 转换为 PDF,但它似乎可以将 HTML 转换为 PDF。也许您可以将 RTF 转换为 HTML,然后将其交给 iTextSharp。互联网上有一个免费的 RTF 转 HTML 工具。
Yes, iTextSharp can't convert RTF to PDF, but it seems it can convert HTML to PDF. Maybe you can convert your RTF to HTML and next give it to iTextSharp. There is a free RTF to HTML tools in Internet.
发布评论
评论(4)
我使用 Office Interop 程序集编写了一个类来执行此操作。如果执行代码的计算机上安装了 MS Word,则此方法效果很好。
http://brandonzeider.me/2010/microsoft-net/convert-文字转pdf/
I wrote a class to do this using the Office Interop assemblies. If you have MS Word installed on the machine executing the code, this works well.
http://brandonzeider.me/2010/microsoft-net/convert-word-to-pdf/
是的,iTextSharp 无法将 RTF 转换为 PDF,但它似乎可以将 HTML 转换为 PDF。也许您可以将 RTF 转换为 HTML,然后将其交给 iTextSharp。互联网上有一个免费的 RTF 转 HTML 工具。
Yes, iTextSharp can't convert RTF to PDF, but it seems it can convert HTML to PDF. Maybe you can convert your RTF to HTML and next give it to iTextSharp. There is a free RTF to HTML tools in Internet.
您可以分两步进行转换:
对于第一步,我编写了 这个库。
对于第二步,我使用了商业产品,但任何开源库也应该可以工作。
You can do the conversion in two steps:
For the first step I have written this library.
For the second step I have used a commercial product, but any open source library should also work.
您可以使用 iTextSharp 创建 pdf 文档。
You could use iTextSharp to create pdf documents.