Hi e-iceblue team,
I just downloaded your Free Spire.PDF version 3.0 for evaluation. I then test inserting images into PDF. I got an error 'Arithmetic operation resulted in an overflow.' when I tried to insert PNG or TIFF into a PDF.
Here is a simple code I used:
PdfDocument doc = new PdfDocument();
PdfSection section = doc.Sections.Add();
PdfImage image = PdfImage.FromFile(@"D:\test\test.png");
float imageWidth = image.PhysicalDimension.Width / 2;
float imageHeight = image.PhysicalDimension.Height / 2;
PdfPageBase page = section.Pages.Add();
page.Canvas.DrawImage(image, 1F, 1F, imageWidth, imageHeight);
page.Canvas.Save();
doc.SaveToFile("D:/test/Transparency.pdf");
doc.Close();
Notes:
- The same code works OK if I use a JPG file instead. The JPG picture is shown correctly in the PDF page.
- When I tried using this code with the not-free Spire.PDF.dll 3.2.31 (from the Spire.PDF Pack Hot Fix,) the code works with PNG file no problem.
In short, the bug I found is that the FREE version cannot work with PNG/TIFF images while the paid version works with all. Is this intended or is this a bug?
Your advice will be helpful for my evaluation purposes.
Yours,
Jim