The TiffDevice class in the Java API (v10.9.0) appears to perform the conversion in memory before writing to the output stream. This limits the size of the documents we can convert. For instance, a 90 page test document exceeded 2G of RAM without any bytes written to the output file.
Is there a better way to convert large documents?
Sample code:
InputStream source = new FileInputStream(“spring-data-mongodb-reference.pdf”);
TiffSettings settings = new TiffSettings();
settings.setCompression(CompressionType.None);
settings.setDepth(ColorDepth.Format4bpp);
settings.setSkipBlankPages(true);
Document pdf = new Document(source);
TiffDevice tiff = new TiffDevice(new Resolution(300), settings);
OutputStream out = new FileOutputStream(“test.tif”);
tiff.process(pdf, out);