new long[][] {rational})
};
renderParams.setExtraFields(fields);
// Creates encoder
TIFFImageEncoder enc = new TIFFImageEncoder(outputStream, renderParams);
// Creates lazy iterator over generated page images
Iterator pageImagesItr = new LazyPageImagesIterator(getNumberOfPages(), log);
// The first image to be passed to enc
RenderedImage first = (RenderedImage) pageImagesItr.next();
// The other images are set to the renderParams
renderParams.setExtraImages(pageImagesItr);
// Start encoding
enc.encode(first);
// Cleaning
outputStream.flush();
clearViewportList();
log.debug("Tiff encoding done.");