pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Tiff to Pdf exception
Date Fri, 20 Apr 2018 04:57:23 GMT
The CCITTFactory can be used only for certain TIFF files, i.e. that are 
packed in the proper way. The solution is to call ImageIO.read() on your 
file and then use the LosslessFactory with the BufferedImage you get. 
You may need jar_imageio.jar ( 
https://github.com/jai-imageio/jai-imageio-core ) or the twelvemonkeys 
library to be able to read .tif files. This will bring the same result 
than with CCITTFactory but will be a bit slower, because the 
CCITTFactory uses the tiff files without decompressing.

Tilman


Am 20.04.2018 um 01:01 schrieb VikramSrinivasan Venkatakrishnan:
> Hello,
>
> I am trying to convert tiff files to PDF and I get the below exception.I
> get the same exception with all the tif files I have tried.
> Kindly assist.
>
>
> byte[] pngByteArray = FileUtils.readFileToByteArray(new
> File("C:\\CCITT_1.TIF"));
> InputStream contentStream = new ByteArrayInputStream(pngByteArray);
> PDDocument doc = new PDDocument();
>
>          PDImageXObject ximage3 = CCITTFactory.createFromByteArray(doc,
> pngByteArray);
>
>
> Exception in thread "main" java.io.IOException: FillOrder 2 is not supported
> at
> org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.extractFromTiff(CCITTFactory.java:408)
> at
> org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromRandomAccessImpl(CCITTFactory.java:261)
> at
> org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromByteArray(CCITTFactory.java:133)
> at
> org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromByteArray(CCITTFactory.java:109)
>
> Thanks,
> Vikram
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message