We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image failed to export when converting above 150 pages TIF to PDF

Hi,

I am using Aspose.Imaging v21.9.0.0

Try to convert a 150 pages and above TIF to PDF and it always failed with “Image failed to export” error and “{duplicate}” inner exception message.

Sample code below. Had to use cache to circumvent the out of memory problem.

Aspose.Imaging.Cache.CacheFolder = AppDomain.CurrentDomain.BaseDirectory;
			Aspose.Imaging.Cache.CacheType = 
Aspose.Imaging.CacheType.CacheOnDiskOnly;
long l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
long l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

MemoryStream ms = new MemoryStream();
	
using (Aspose.Imaging.Image img = Aspose.Imaging.Image.Load(streamTIF) )
{
	TiffImage tiffImg = (TiffImage)img;
	PdfOptions pdfOptions = new PdfOptions()
	{
	ResolutionSettings = new Aspose.Imaging.ResolutionSetting(tiffImg.HorizontalResolution, tiffImg.VerticalResolution),
	//MultiPageOptions = new MultiPageOptions(new Aspose.Imaging.IntRange(0, tiffImg.Frames.Count())),

	};
	//img.Save(AppDomain.CurrentDomain.BaseDirectory + "150.pdf", pdfOptions);
	img.Save(ms, pdfOptions);

	long diskBytes = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
	long memoryBytes = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;
}


			l1 = Aspose.Imaging.Cache.AllocatedDiskBytesCount;
			l2 = Aspose.Imaging.Cache.AllocatedMemoryBytesCount;

			return ms;

151.zip (1.9 MB)

@praetorion

It’s a fairly large image that you are dealing with. Please try using sample code given over following documentation article to load image in batch mode and render that.