PDFBOX JPEG2000使用例如Twelvemonkeys-jpeg渲染以避免专利问题

发布于 2025-02-11 03:26:56 字数 1016 浏览 2 评论 0 原文

我得到了一个使用PDFBox打开的PDF文件(版本2.0.20,但不应与版本相关)。该文件的页面实际上是JPEG2000图像。

首先,我发现了众所周知的错误:无法阅读JPEG2000图像:Java高级成像(JAI)图像I/O工具未安装。

我在POM中添加了JAI核心工具和相应的JPEG2000插件:

<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>1.4.0</version>
</dependency>

<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>1.3.0</version>
</dependency> 

一切正常!

但是:互联网说,如果您不付款而使用Jai-Imageio-Jpeg2000的使用将侵犯专利。

因此,我的问题是,我可以让PDFBox使用其他模块吗?我知道Twelvemonkeys是一个不错的选择,并且我读了一些测试的线程。但是我没有找到Howto,如何使PDFBox切换到Twelvemonkeys。

我从POM中删除了上面的内容,并添加了TwelvemonKeys,但这不起作用(从上方获得错误消息)

<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-jpeg</artifactId>
<version>3.8.2</version>
</dependency>

I got a pdf file which I open with PDFBox (version 2.0.20, but should be not version related). The file has a page which is actually a JPEG2000 image.

First I got the well known error : Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools are not installed.

I added the JAI core tools and the corresponding jpeg2000 plugin in my POM:

<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>1.4.0</version>
</dependency>

<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>1.3.0</version>
</dependency> 

And everything works fine!

BUT: the internet says, that the usage of jai-imageio-jpeg2000 infringes patents if you use without paying.

Therefore my question is, can I make PDFBox use a different module? I understood that twelvemonkeys is a good choice and I have read some threads where it was tested. But I have found no howto, HOW to make pdfbox switch to e.g. twelvemonkeys.

I removed the above from the POM and added the twelvemonkeys, but that does not work (got again the error message from above)

<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-jpeg</artifactId>
<version>3.8.2</version>
</dependency>

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

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

发布评论

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

评论(1

浪荡不羁 2025-02-18 03:26:56

因此,最后我使用了Jdeli库。这是一个商业图书馆,在撰写本文时,您需要每年支付800美元或一次性付款4000美元。但是,基于这样一个事实,即有了JJ2000代码的专利问题,您可能会遇到更大的问题,我决定将项目与之相关。

钱是一个话题,但是我的jpeg2000 pdfbox的问题是否消失了?是的!

我遵循网页上的说明():

我下载了试验lib,添加到了我的maven存档中,并将其添加到我的pom.xml中

<dependency>
    <groupId>com.idrsolutions</groupId>
    <artifactId>jdeli</artifactId>
    <version>1.0</version>
</dependency>

:想要将产品用作JAI插件,我还检查了该插件的GIT项目:

结帐后,我进行了 mvn install ,并且插件在我的MVN repo中。然后,我还将插件作为依赖性添加到我的pom.xml:

<dependency>
    <groupId>com.idrsolutions</groupId>
    <artifactId>JDeli_ImageIO_Plugin</artifactId>
    <version>1.0</version>
</dependency>

从这里我的pdfs带有jpeg2000图像的pdf,可以按预期加载PDFBox。

因此,这不会回答我的问题如何使用TwelvemonKeys读取带有jpeg2000内部pdfbox的pdfs的pdf(请参见上文),但是它提供了一种至少对我有用的替代方案,只要您可以接受支付付款图书馆。

So finally I used the JDeli library. It is a commercial library and at time of writing you need to pay between 800$ per year or a one-time payment of 4000$. But based on the fact that with patent problem of the JJ2000 code you might run into even bigger issues, I decided for our project to go with it.

Money is one topic but do my jpeg2000 problems with the pdfbox disappear? Yes!

I followed the instructions on the web page (https://support.idrsolutions.com/jdeli/tutorials/add-jdeli-as-a-maven-dependency):

I downloaded the trial lib, added to my maven archive and added this to my pom.xml:

<dependency>
    <groupId>com.idrsolutions</groupId>
    <artifactId>jdeli</artifactId>
    <version>1.0</version>
</dependency>

As I wanted to use the product as JAI plugin I also checked out the git project for the plugin : https://github.com/idrsolutions/JDeli_ImageIO_Plugin

After checkout I did the mvn install and the plugin was in my mvn repo. I added then also the plugin as dependency to my pom.xml:

<dependency>
    <groupId>com.idrsolutions</groupId>
    <artifactId>JDeli_ImageIO_Plugin</artifactId>
    <version>1.0</version>
</dependency>

From here my pdfs with the jpeg2000 images inside could be loaded with pdfbox as expected.

So this will not answer my question how to use twelvemonkeys to read pdfs with jpeg2000 inside with pdfbox as it is not possible (see above), but it provides an alternative which worked at least for me as long as you can accept to pay for the library.

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