包含JBIG2图像打印PDF [英] Print PDF that contains JBIG2 images

查看:466
本文介绍了包含JBIG2图像打印PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请,建议我有些库将帮助我包含JBIG2 EN $ C $光盘镜像打印PDF文件。 PDFRenderer PDFBox的不帮我。这些库可以打印简单的PDF,但含有JBIG2图像不PDF。 PDFRenderer 试图修复它(根据上PDFRedndrer的bug追踪系统漏洞问题),但有些页面仍(尤其是在酒吧codeS存在)不希望打印。

Please, suggest me some libraries that will help me print PDF files that contain JBIG2 encoded images. PDFRenderer, PDFBox don't help me. These libs can print simple PDF, but not PDF containing JBIG2 images. PDFRenderer tries to fix it (according to bug issue on PDFRedndrer's bug tracker), but some pages still (especially where barcodes exist) don't want to print.

P.S。我使用的javax.print 小程序API

P.S. I use javax.print API within applet

谢谢!

更新:也试过ICEPdf,太不想上班

UPDATE: also tried ICEPdf, is too don't want to work.

我得出的结论是,所有这些库(PDFRenderer,ICEPdf,PDFBox的)使用 JPedals JBIG2去codeR 。臭虫(某些页面未打印)来自这个德codeR库。这个德coder的开源版本(在PDFRenderer使用,ICEPdf,PDFBox的)不再支持,但 JPedal 的项目的一个新的商业分支,他们写道,该bug已被固定在新的商业版本,售价$ 9K。

I came to the conclusion that all these libraries(PDFRenderer, ICEPdf, PDFBox) use JPedals jbig2 decoder. Bug (some pages didn't print) come from this decoder library. The open source version of this decoder (which is used in PDFRenderer, ICEPdf, PDFBox) is no longer supported, but JPedal has a new commercial branch of the project, and they wrote that the bug has been fixed in new commercial release, which costs $9k.

任何想法?

更新2 :昨天我试图取代 JPedal的免费图书馆与其他开源 JBIG2-的ImageIO 库。但我却没有得到任何成功的结果,所以我创建自己的项目页面上的一个新课题(google- code的论坛 - 的这里)。将感谢任何帮助。

UPDATE 2: yesterday I tried to replace JPedal's free library with other open-source jbig2-imageio libraries. But yet I don't get any successful results, so I created a new topic on their project's page (google-code's forum - here ). Would be grateful for any help.

我也发现了的Apache PDFBox的的bug跟踪一些有益的讨论:的这里这里

I also found some helpfull discussions on Apache PDFBox bug-tracker: here and here.

推荐答案

有是Borisvl的JPedal库的一个分支位于

There is a fork of the JPedal library by Borisvl located at

https://github.com/Borisvl/JBIG2-Image-德codeR#自述

包含速度提升,我相信这也应该解决您的错误。

which contains speed improvements and I believe it should also fix your bug.

编辑:该错误是涉及到简单的范围检查。基本上你需要prevent GetPixel访问位图范围之外的x,y值。

EDIT : The bug is related to simple range checking. Basically you need to prevent GetPixel from accessing x,y values outside of the bitmap extents.

您需要确保下列条件调用getPixel之前得到满足。

You need to make sure the following conditions are met before calling getPixel

山口> = 0和col&下; bitmap.width
  行> = 0和行< bitmap.height

col >= 0 and col < bitmap.width row >= 0 and row < bitmap.height

下面是一些德尔福code与一对夫妇的小范围的检查。我不能测试Java code自己,但是你需要修改的src /组织/ jpedal / JBIG2 /图像/ JBIG2Bitmap.java

Here is some Delphi code with a couple of small range checks. I cannot test the Java code myself but you need to make changes to src/org/jpedal/jbig2/image/JBIG2Bitmap.java

procedure TJBIG2Bitmap.combine(bitmap: TJBIG2Bitmap; x, y: Integer; combOp: Int64);
...
...
var
begin
  srcWidth := bitmap.width;
  srcHeight := bitmap.height;
  srcRow := 0;
  srcCol := 0;

  if (x < 0) then x := 0;
  if (y < 0) then y := 0;

  for row := y to Min(y + srcHeight - 1, Self.height - 1) do   // <<<<<<<<  HERE
  begin
    for col := x to x + srcWidth - 1 do
    begin
      srcPixel := bitmap.getPixel(srcCol, srcRow);

安德鲁。

这篇关于包含JBIG2图像打印PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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