Java 从 RTF 生成 PDF
我想从 RTF 文件生成 PDF 文件。 我尝试过以下。
文本 它已经过时了,新版本不支持 rtf。
JDocConverter 它在后台使用OpenOffice。它工作正常,只有一个问题。 Open Office 不支持 RTF 格式的绘图对象。
还有其他可能且可靠的解决方案吗?
注意:最好不要使用任何商业软件。
I want to generate PDF file from RTF file.
I have tried following.
Itext
It's already outdated and new version doesn't support rtf.JDocConverter
It uses OpenOffice on the background. it is working fine, there is only one problem. Open office doesn't support drawing object in RTF.
Any other possible and reliable solutions?
Note: It would be fine don't use any commercial software.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Windows 本身就可以使用命令行将 RTF 转换为 PDF,但是它会受到一定程度的限制,因此它将使用直接转换文本和图像,但这将取决于 rtf 语法来支持哪些绘制对象。 WORD ART 绘图对象需要 MS Word 才能打印
输出看起来合理,但这里是 MSWord 中的源,其中艺术显然不是由非文字打印输出处理的。
Windows has native convert RTF to PDF using command line, however it will to a degree be limited, so it will use direct convert text and images, but it will depend on rtf syntax as to which drawn objects are supported. WORD ART drawing objects need MS Word to print
The output looks reasonable but here is the source in MSWord where the art was clearly not handled by the non-word printout.
您可以尝试 Aspose.Words for Java 将 RTF 文件转换为 PDF 格式。您可以 加载将 RTF 格式的文件导入 Aspose.Words for Java,然后 保存为 PDF 格式。请注意,加载时指定 RTF 作为 LoadFormat 值,并在保存文档时将 PDF 作为 SaveFormat 值传递。这不需要安装 OpenOffice 或任何其他软件即可进行转换。
披露:我在 Aspose 担任开发人员传播者。
You may try Aspose.Words for Java to convert RTF file to PDF format. You can load a file in RTF format into Aspose.Words for Java and then save it to PDF format. Please note that while loading specify RTF as LoadFormat value and pass PDF as SaveFormat value while saving the document. This doesn't require OpenOffice or any other software to be installed for the conversion to work.
Disclosure: I work as developer evangelist at Aspose.
在 Windows 下,您可以打印到 CutePDF Writer。该免费软件使用 Ghostscript 作为后端。
Under Windows you could print to CutePDF Writer. This freeware uses Ghostscript as a back end.
最好的方法是使用 MS Office。 Ms Office 能够以 PDF 格式保存文件(我认为你需要安装一些插件)。
Best way to do it is use MS Office. And Ms Office is able to save file in PDF format (you need install some addons I think).