java jbig 包,包含JBIG2图像打印PDF

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. I use javax.print API within applet

Thanks!

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

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.

Any ideas?

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.

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

解决方案

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

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

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.

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

col >= 0 and col < bitmap.width

row >= 0 and row < bitmap.height

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);

Andrew.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值