Inserting Specific TIFF Throws Error on Save()

Inserting a specific TIFF (attached as ThrowsError.tif) throws an error on the Save() call with this message:

Object reference not set to an instance of an object.

This TIFF can be imported and displayed properly by my client’s document management software (Oracle IPM).

Here is the test code I used:

Private Sub ImportIt()
Dim pdf1 As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
Dim image1 As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image(sec1)
image1.ImageInfo.File = “D:\tmp\ThrowsError.tif”
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff
sec1.Paragraphs.Add(image1)
pdf1.Save(“D:\tmp\test.pdf”)
End Sub

Below is the stack trace (for some reason the method names are garbage in the stack trace):

at e.ž.€(— , Int32 , ImageFileType , String , String , String , Int32 , Int32 , Boolean , Boolean , Boolean , Boolean , Byte[] , Stream , „ )
at e.—.€(Image , ImageFileType , String , String , String , Int32 , Int32 , Boolean , Boolean , Byte[] , Stream , „ )
at ..€(Pdf , Image )
at ..€(Pdf , Section , Table , Row , Cell , Image , , œ )
at .‘.€(Pdf , Section , HeaderFooter , Table , Row , Cell , Image , , œ , Boolean )
at ..€(Pdf , Section , )
at ..€(Pdf )
at .Š.€( , Pdf )
at Aspose.Pdf.Generator.Pdf.Save(String pdfFile)
at Test() in test.vb:line 10

Hi Joseph,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I tested your issue with the latest version of Aspose.Pdf for .NET and I am able to reproduce the problem regarding Tiff not getting inserted in PDF file. I have registered the issue in our issue tracking system with issue id: PDFNEWNET-34553. We will further investigate the issue and get back to you.

Also, when I try to open your shared Tiff file in Windows Picture Viewer or Microsoft Office Picture Manager, both are not opening the Tiff file. Please provide us some more details regarding how you have generated this tiff file. This will help us in understanding the problem.

Sorry for the inconvenience,

This file was created by one of my clients, probably using a scanner. Sorry, I don’t have any additional details besides that. I’ve attached a screen shot of the image as seen in the Oracle IPM software they use.

Hi Joseph,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

I will share the details with the development team for further investigation.

Sorry for the inconvenience,

Hi Joseph,


Thanks for your patience.

We have further investigated the issue regarding TIFF to PDF conversion and as per our observations, the source TIFF image is not correct. The structure of TIFF image seems to be damaged. I am afraid we might not be able to resolve this problem. We are sorry for this inconvenience.

PS, Please note that the TIFF image is neither being displayed in Windows Photo Viewer nor I am able to open the Image in MS Paint.