phax / ph-pdf-layout

Java library for creating fluid page layouts with Apache PDFBox. Supporting multi-page tables, different page layouts etc.
Apache License 2.0
61 stars 11 forks source link

UnsupportedOperationException in PLImage #3

Closed phax closed 6 years ago

phax commented 6 years ago

@trautvetter - Copy from https://github.com/phax/ph-commons/issues/9

Hi Philip, I'm getting an UnsupportedOperationException in PLImage using certain images. The exception message is:

Caused by: java.lang.UnsupportedOperationException: BITMASK Transparency JPEG compression is not useful, use LosslessImageFactory instead

My BufferedImage is obtained by from a URL however I'm sorry but I can't give that to you so instead I have attached the image itself.

nrl-manly16

I've been able to implement my own AbstractPLImagewhich uses LosslessFactory.createFromImage() to return a PDImageXObject and use this class in place of your PLImage. However I was wondering if you were aware of this problem and decided to raise this issue.

Thank you.

phax commented 6 years ago

@trautvetter most important question: what version of ph-pdf-layout are you using 3.x, 4.x or 5.0.0? I see the problem in the latest version and I think there is an easy way to fix this

phax commented 6 years ago

Btw. I created an issue that would help in resolving the issue https://issues.apache.org/jira/browse/PDFBOX-4042

trautvetter commented 6 years ago

@phax - I'm using version 4.0.1 but planning to move to 5.0.x at some point.

phax commented 6 years ago

Okay thanks. Moving to 5.0.0 should be no big issue. Major change was in the base libraries (ph-commons 9.0.0) but no major API changes here.

phax commented 6 years ago

Starting with v5.0.1 you have the possibility to provide an EPLImageType that identifies the factory to be used. Current values are CCITT, JPEG and LOSSLESS

trautvetter commented 6 years ago

Thank you, I will probably switch sometime next month and will look forward to the 5.0.1 release. I'm really enjoying this library by the way. Thank you so much for making it available.

phax commented 6 years ago

Thanks for your feedback. Any contributions like documentation, examples etc. are welcome. Btw. how did you stumble upon ths lib? I'm not really actively advertising it :)

trautvetter commented 6 years ago

I started writing my own library based on a css type approach but after a quick Google search to see if something already existed or not, I found your lib, and well, it suits my needs perfectly. I could certainly put together some examples to contribute.

phax commented 6 years ago

5.0.1 is release - the PDFBox issue is not handled atm