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: ImageIOUtil.writeImage and multipage TIFF
Date Wed, 05 Nov 2014 21:02:24 GMT
Hi,

Glad you like the improvements.

I experimented on this for myself some time ago by using this code:
https://www.java.net/node/670205  (I used solution 2 which doesn't use 
JAI and modified the code so that it does compression)

However...

If you create an array with lots of images, your memory consumption 
really goes up. So it would probably be better to render an image, then 
add it to the tiff file, then render the next page and lose the 
reference of the previous one so that the gc can get the space if needed.

Another reason why I didn't think about adding it to PDFBox is that the 
ImageIOUtils is format-independent, i.e. you just pass an image and a 
format name and it should work in a best possible way. But multipages 
are available only for TIFF, so we'd suddenly have something specific 
for a format.  (pcx also supports multipage, but I doubt that this is 
still used in the wild)

Tilman

Am 05.11.2014 um 21:24 schrieb A.D. Kent:
> Hello PDFBox community,
>
> Is there any way to utilize the new ImageIOUtils to convert PDF to 
> multi-page TIFF?  The improved ImageIOUtils is great, but only 
> supports conversion of a single BufferedImage to an OutputStream, and 
> I'd like to write an array of BufferedImage to a multi-page TIFF.  As 
> it stands right now, my current process utilizes PDFRenderer to 
> produce an array of BufferedImage, which I convert to multi-page TIFF 
> via JAI.
>
> Just looking for a more efficient way.
>
> Thanks,
>
>
> A.D. Kent
>
>


Mime
View raw message