Exception when inserting TIF into PDF

Hi!

I have a problem inserting *some* TIF-files into PDFs. I can open these files without problems, but sometimes I get an Exception:

System.ApplicationException: Can´t open image file *path to file* at Aspose.Pdf.Pdf.Save(String pdfFile)

Does Aspose.Pdf only support some types of tif-files?

Thanks,

Michael

Hello Michael,

Thanks for using our products.

Can you please share the source TIFF file so that we can test the scenario at our end. We apologize for your inconvenience.

Hello,

here is the file.

Thanks,

Michael

Hello Michael,

Thanks for sharing the resource file.

I have tried viewing the TIFF file in Microsoft Office Picture Manager and Windows Picture and Fax viewer but I am afraid I am unable to preview the image file. More along, I have tried converting the image file into PDF format but I am afraid I am getting an error message that " Can't open image file D:\pdftest/LargeTiff.tif". Can you please check the image at your end.

I have tested the scenario over Windows XP SP3 in Visual Studio 2005 where Aspose.Pdf for .NET version is 4.6.0

We apologize for your inconvenience.

Hi,

on a XP Machine I receive the same error, but on my Win7 machine the file opens without problems (also with windows picture viewer).

Thanks,

Michael

Hello Michael,

Thanks for sharing the information.

I have also tested the scenario using Aspose.Pdf for .NET 4.6.0 over Windows 7 Enterprise 64 Bit while using Visual Studio 2008 and I am unable to notice any problem. The TIFF image is properly being converted into PDF format and I am able to open the PDF file. Can you please confirm which version of Aspose.Pdf for .NET you are using ?

Hi,

I am using the same version on Win7 x64 professional.
How can we fix that issue?

Regards,

Michael

Hello Michael,

Can you please share which version of Aspose.Pdf for .NET you are using and if possible, please share the code snippet that you are using. We are sorry for your inconvenience.

Hi,

here my code:

Pdf pdf1 = new Pdf();

Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(sec1);

sec1.Paragraphs.Add(image1);

image1.ImageInfo.File = file;

if (file.ToLower().EndsWith(".jpg")) image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;

if (file.ToLower().EndsWith(".png")) image1.ImageInfo.ImageFileType = ImageFileType.Png;

if (file.ToLower().EndsWith(".tif")) image1.ImageInfo.ImageFileType = ImageFileType.Tiff;

pdf1.Save(file + ".pdf");

return file + ".pdf";

I am using Aspose.Pdf 4.6.0.0

Hello Michael,

Thanks for sharing the information.

I have tested the scenario using following code snippet while using Aspose.Pdf for .NET 4.6.0 over Windows 7 Enterprise 64Bit where my .NET Compact Framework version is 3.5 and I also have .NET Compact Framework 2.0 SP2 installed over my machine and I am unable to notice any problem. The resultant PDF that I have generated is also in attachment. Please take a look.

Can you please share some more information regarding your working environment. We apologize for your inconvenience.

[C#]

String filename = "d:/pdftest/Scan+v001.tif";
//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Section sec1 = pdf1.Sections.Add();

//Create an image object in the section
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Set the path of image file
image1.ImageInfo.File = filename;

//Set the type of image using ImageFileType enumeration
if (filename.ToLower().EndsWith(".jpg")) image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;
if (filename.ToLower().EndsWith(".png")) image1.ImageInfo.ImageFileType = ImageFileType.Png;
if (filename.ToLower().EndsWith(".tif")) image1.ImageInfo.ImageFileType = ImageFileType.Tiff;
// set the value that all the frames of TIFF image are included in PDF document
image1.ImageInfo.TiffFrame = -1;
//Set image title
image1.ImageInfo.Title = "TIFF image";

//Save the Pdf
pdf1.Save("d:\\pdftest\\TiffImage_Conversiontest.pdf");

Hello!

It works on Windows7 x64 with .net 3.5
It works NOT on Windows XP with .net 3.5

Both with Aspose.Pdf 4.6.0 and same code.

Thanks,

Michael

Hello Michael,

I have tested the scenario and I am able to notice the problem that TIF to PDF conversion is not working over WindowsXP. For the sake of correction, I have logged it in our issue tracking system as PDFNET-20693. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.