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

Free Support Forum - aspose.com

Problems converting TIF file to PDF

I’m trying to convert .TIF files to PDF. We’re using the 9.4 version of the Aspose.Words product. Some TIF files work ok…most do not. I an error stating “A generic error occured in GDI+” I used the provided example code provided in converting an image to PDF.


private System.IO.Stream ConvertImageToPdfStream(Image image)

//Create the memory stream
MemoryStream pdfStream = new MemoryStream();

// Create Aspose.Words.Document and DocumentBuilder.
// The builder makes it simple to add content to the document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Read the image from file, ensure it is disposed.
// Get the number of frames in the image.
int framesCount = image.GetFrameCount(FrameDimension.Page);
// Loop through all frames.
for (int frameIdx = 0; frameIdx < framesCount; frameIdx++)
// Insert a section break before each new page, in case of a multi-frame TIFF.
if (frameIdx != 0)

// Select active frame.
image.SelectActiveFrame(FrameDimension.Page, frameIdx);

// We want the size of the page to be the same as the size of the image.
// Convert pixels to points to size the page to the actual image size.
PageSetup ps = builder.PageSetup;
ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);
ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

// Insert the image into the document and position it at the top left corner of the page.
imageToByteArray(image), <—I also tried with just the image…same error
} //end for
// Save the document to PDF.
//Save it to a stream…
doc.Save(pdfStream, Aspose.Words.SaveFormat.Pdf);
pdfStream.Position = 0L;
return pdfStream;
} //end ImagetoPdfStream

Dear Doug,

Thank you for your request.

In order to reproduce the issue reported by you, I would ask you to provide us with .tif files with which you experience problem.

Thank you for cooperation.