在 Java 中将 PDF 转换为 RTF [英] Convert PDF to RTF in Java

查看:85
本文介绍了在 Java 中将 PDF 转换为 RTF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道可用于在 Java 中将 PDF 文档转换为 RTF 的易于使用的库或 SDK?

Does anyone know of an easily available library or SDK which can be used to convert a PDF document to RTF in Java?

推荐答案

再看看 iText(我知道直接 PDF -> 不支持 RTF 转换 - 但请继续阅读以了解脊椎刺痛的可能性!).

Take another look at iText (I know that direct PDF -> RTF conversion isn't supported - but read on for spine tingling possibilities!).

  1. 我们去年在 iText 中添加了一个 PDF 文本解析模块.目前,这有点初级,但确实有效,而且很容易扩展.

  1. We added a PDF text parsing module to iText last year. Right now, this is somewhat rudimentary, but it does work, and is pretty easy to expand.

iText 擅长生成 RTF.

iText is good at generating RTF.

所以...从 PDF 中解析文本并根据解析创建 RTF 应该相对简单(不容易,但很简单).

So... It should be relatively straightforward (not easy, but straightforward) to parse text from a PDF and create an RTF based on the parsing.

如果您必须保留字体之类的内容,则需要做更多的工作(PDF 解析器确实提供字体信息以及每段文本的页面位置),但我怀疑 iText 的 RTF 生成器会简化很多.

If you have to preserve things like font, it will take a little bit more work (the PDF parser does provide font info, as well as page location for each piece of text), but I suspect that iText's RTF generator will simplify a lot of that.

如果您的 PDF 文件包含需要转移到 RTF 的嵌入图像,当前的 PDF 解析器实际上并没有做太多的事情 - 但它有足够的钩子来允许它发生一些肘部油脂.

If your PDFs contain embedded images that you need to bring over to the RTF, the current PDF parser doesn't really do much with that - but it has sufficient hooks to allow it to happen with a bit of elbow grease.

所以我想说 iText 很可能可以做你正在寻找的东西,并且会帮助你实现本地最少的开发工作,但我不会把它放在超级类中简单……实际上,这听起来是个不错的挑战.

So I would say that iText can most likely do what you are looking for, and will help you achieve a local minimum of development effort, but I wouldn't put this in the class of super easy... Sounds like a nice challenge, actually.

如果你最终实现了这样的东西,在你有机会玩一会之后,请随时向我提出问题/想法.如果您最终得到了相当多的转换代码,我们可能希望将其添加到 iText.

If you do wind up implementing something like this, feel free to ping me with questions/thoughts after you've had a chance to play a bit. If you wind up with a decent bit of converting code, we might want to get it added to iText.

如果您只想将其推出,并且您有钱花,我相信有许多商业转换器可以满足您的需求.可能不会便宜,但可能比您的开发时间便宜.

If you are wanting to just get this out the door, and you have money to spend, I'm sure that there are a number of commercial converters that do what you are looking for. Probably won't be cheap, but may be cheaper than your development time.

这篇关于在 Java 中将 PDF 转换为 RTF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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