Hi Support Team,
I'm trying to convert an .gif image to pdf using Aspose.Pdf for .NET. I got below error while converting: "A generic error occurred in GDI+."
I have attached the download.gif image as well.
// Instantiate Document Object
var doc = new Document();
// Add a page to pages collection of document
Page page = doc.Pages.Add();
// Load the source image file to Stream object
var fs = new FileStream("../../download.gif", FileMode.Open, FileAccess.Read);
var tmpBytes = new byte[fs.Length];
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));
var mystream = new MemoryStream(tmpBytes);
// Instantiate BitMap object with loaded image stream
Bitmap b = new Bitmap(mystream);
// Set margins so image will fit, etc.
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;
page.CropBox = new Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height);
// Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
// Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1);
// Set the image file stream
image1.ImageStream = mystream;
// Save resultant PDF file
doc.Save("c:/download-GIF.pdf");
// Close memoryStream object
mystream.Close();
Please help me to resolve this issue.