Problems converting TIF to PDF

Hi,

I'm trying to convert .TIF file to PDF. We're using the 5.2 version of the Aspose.Pdf product. This works fine on my Windows 7 development machine, but doesn't work on Windows XP or Window 2003 or Windows 2008 machines.

I an error stating "A generic error occured in GDI+"

I used the provided C# example code provided in converting an image to PDF. Also the image I am trying to convert is attached.

Initially I posted this under Aspose.Word product family by mistake. Please ignore the other post.

Please let me know if there is a workaround for this issue.

Thanks

Suhas

string tempFileName = Path.GetTempFileName();

//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();

//Create a section in the Pdf object
Aspose.Pdf.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 = txtSourcePath.Text;

//Set the type of image using ImageFileType enumeration
try
{
using (System.Drawing.Image img = System.Drawing.Image.FromFile(txtSourcePath.Text))
{
if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
{
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;
}

else if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Bmp))
{
image1.ImageInfo.ImageFileType = ImageFileType.Bmp;
}

else if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
{
image1.ImageInfo.ImageFileType = ImageFileType.Gif;
}

else if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
{
image1.ImageInfo.ImageFileType = ImageFileType.Tiff;
}
}
}
catch { }

//Save the Pdf
pdf1.Save(tempFileName);

v

Hello Suhas,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 5.4.0 over Windows7 Professional (X64) as well as over Windows Server 2008 R2 Standard (X64) and I am unable to notice any problem. The problem seems to be fixed in v5.4.0 which is available for download over this link.

Can you please try using this new release and in case you still face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hello Nayyer Shahbaz,

Thanks for the quick reply. I tried with v5.4 and as specified in my previous email, this works fine on Windows 7 (x64).

But the problem is on a Windows Server 2003 SP2 machine.On Windows Server 2003 SP2 I get the following error:

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)

at System.Drawing.Image.Save(Stream stream, ImageFormat format)

at (Object , Stream , ImageFormat )

at ..‚(Pdf , Section , Table , Row , Cell , Image , , e )

at ..‚(Pdf , Section , HeaderFooter , Table , Row , Cell , Image , , e , Boolean )

at .€.‚(Pdf , Section , )

at .ƒ.‚(Pdf )

at ..‚( , Pdf )

at Aspose.Pdf.Pdf.Save(String pdfFile)

Hello Suhas,

In your first post, you have specified that the problem is also occurring on Windows Server 2008 so in my previous attempt, I tested the scenario over Windows 2008 and Windows 7 (knowing the fact that conversion worked fine over WIndows7 but just in case I wanted to test the latest version). Nevertheless, I will again test the scenario over Windows Server 2003 and will keep you updated with my findings. Please be patient and spare us little time. We are really sorry for this inconvenience.