How to set StripOffset, RowsPerStrip, ImageSize in Aspose.PDF for Java while converting pdf to tiff


I am evaluating Aspose.PDF for Java to convert pdfs to tiff images in our organization.
I have received sample pdf and correct Tiff files from business which is required to be generated. Here is the metadata for the tiff file which is readable in our workflow system.

Correct_File_Metadata.png (30.7 KB)

I tried converting sample PDF to Tiff using aspose java sdk 19.8 using sample source code from aspose git repo and generated tiff has different metadata as follows.

Incorrect_File_Metadata.png (18.8 KB)

Our existing system is unable to read tiff files generated by aspose.pdf for Java sdk and based on metadata it seems I need to set StripOffset, RowsPerStrip properties.
In documentation of aspose.pdf for java, I don’t see any where how do I set StripOffset, RowsPerStrip and ImageSize settings so that I can generate correct Tiff.
Can you help me how do I set those properties and have same metadata as required ?

Here is Java source code.

public static void convertAllPDFPagesToTIFFImages(String pdfSourceFile, String tiffDestinationFolder, int dpi, String licensePath, int Bpp) throws IOException {

	// Open document
	Document pdfDocument = new Document(pdfSourceFile);
	// License
	com.aspose.pdf.License license = new com.aspose.pdf.License();
	try {
	} catch (Exception e) {
		// TODO Auto-generated catch block
		System.out.println("Continuing as trial...");
	int numberOfPages = pdfDocument.getPages().size();
	if(com.aspose.pdf.Document.isLicensed()) {
		System.out.println("License is set");
		System.out.println("If license expires, only 4 pdf pages will be converted. Full version of pdf to tiff conversion will not work.");
		numberOfPages = 4;
		System.out.println("No license found, only 4 pdf pages will be converted. Full version of pdf to tiff conversion will not work.");

	// Create Resolution object 
	Resolution resolution = new Resolution(dpi);
	System.out.println(String.format("Resolution: %s", Integer.toString(dpi)));
	// instantiate TiffSettings object
	TiffSettings tiffSettings = new TiffSettings();
	// set the compression of resultant TIFF image
	System.out.println(String.format("Compression: %s", "CCITT4"));
	// set the color depth for resultant image
	int colorDepth = ColorDepth.Format1bpp; // default 1 bit per pixel
	if(Bpp == 4) {colorDepth = ColorDepth.Format4bpp;}
	if(Bpp == 8) {colorDepth = ColorDepth.Format8bpp;}
	System.out.println(String.format("ColorDepth: %s  (1 : 8bpp, 2 : 4bpp, 3 : 1bpp)", Integer.toString(colorDepth)));
	// skip blank pages while rendering PDF to TIFF
	System.out.println("Skip blank pages : False");

	// Create TiffDevice object with particular resolution
	TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
	// Loop through number of pages of PDF file
	Date date = new Date();
	SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
	System.out.println("Conversion started:");
	for(int i=1; i<=numberOfPages; i++) {
		// Create stream object to save the output image imageStream = new + "\\"+ String.format("Image_%sbpp_%sdpi_page%s.tiff", Integer.toString(Bpp), Integer.toString(dpi), Integer.toString(i)));

		// Convert a all pages of PDF file to TIFF format
		tiffDevice.process(pdfDocument, i, i, imageStream);
		// Close the stream

	date = new Date();
	System.out.println("Conversion completed:");



Thank you for contacting support.Would you please elaborate the tool or application you are using to view these properties while sharing two respective PDF documents and the TIFF images, as ZIP, as so that we may observe similar differences among the files and proceed further. Before sharing requested data, please ensure using Aspose.PDF for Java 19.9.


Hi @Farhan.Raza ,

Thank you for your reply. I am using to check Tiff metadata.
I used Aspose.PDF for Java 19.8 and I checked release notes of 19.9 there is no related changes made.
PDF file and Tiff images are business specific files (with dummy data though), but just to make sure I can’t share them publicly. Do you have any way to share just to Aspose team?



Please note that the forum attachments will be accessible to you, when signed in, and Aspose staff only. However, if size of data is huge then you may upload it to Google Drive, Dropbox etc. and share the download link privately with us by clicking on my username and then message icon.


Thank you. I sent you a private message.



We have logged an enhancement ticket with ID PDFNET-47096 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.


Thank you very much @Farhan.Raza