Tiff to Pdf conversion missing colored pages after conversion


#1

Hi there,
In the project I am working on I am converting tiff files to pdf using aspose-imaging-3.6. The tiff file contains both blackwhite and colorful pages(41 pages). After conversion the colorful pages are missing in the resulting pdf(33 pages). Here is the code snippet I use for conversion:

	Document doc = new Document();
	float marginInCm = 0.0f;
	Page page = doc.getPages().add();
	page.getPageInfo().getMargin().setTop(PageConvertUtil.convertCmToPoints(marginInCm));
         page.getPageInfo().getMargin().setBottom(PageConvertUtil.convertCmToPoints(marginInCm));
		page.getPageInfo().getMargin().setLeft(PageConvertUtil.convertCmToPoints(marginInCm));
		page.getPageInfo().getMargin().setRight(PageConvertUtil.convertCmToPoints(marginInCm));
		try(FileInputStream fis = new FileInputStream(file)){
			Image image1 = new Image();
			page.getParagraphs().add(image1);
			image1.setImageStream(fis);
			doc.save(result.getPdfResultFile().getAbsolutePath(), SaveFormat.Pdf);
		}

With this code I can convert bmp, jpeg files to pdf. I can also convert tif to pdf if the tif file does not contain colored page or contains only colored pages.


#2

@alisihab,

I like to inform that you are using very old version of Aspose.Imaging. Can you please try to use Aspose.Imaging latest version on your end and if there is still an issue than please share source files along generated result so that we may further investigate to help you out.


#3

@Adnan.Ahmad,
Thanks for your quick response. I upgraded aspose-imaging to 18.11 and the problem remains. It seems that aspose library recognizes the file as black and white. I created temporary file using:

TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffJpegRgb);
image = com.aspose.imaging.Image.load(file.getAbsolutePath());
image.save(tmpImageFile.getAbsolutePath(), options);

Then, converted that file and the result was as expected.

Is it possible to load the file with TiffLoadOptions and expected format as rgb?


#4

@alisihab,

I have observed your comments and request you to please share the source and generated output file for comparison on our end.