Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Feb 08, 2018 6:33 pm

I just downloaded free Spire PDF for .NET and followed the sample code in your website to generate an image from a PDF but I am getting the following error: "Generic error in GDI+".

Sample code is here: https://www.e-iceblue.com/Tutorials/Spi ... rself.html

This error occurs in line: imgImagen.Save("convertToBmp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

I include the code for your reference. I am using the whole namespace path because I had a conflict with other namespace's properties and method names.

I am using a ASP.NET Web Forms project and Visual Studio 2015 to perform my tests.

Best regards,
Jorge Maldonado

Code: Select all
public void GenerateImage()
    {
        PdfDocument objDoc = new PdfDocument();
        objDoc.LoadFromFile(@"c:\Temp\UserManual.pdf");
        System.Drawing.Image imgImagen = objDoc.SaveAsImage(0);
        System.Drawing.Image emf = objDoc.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Metafile);
        System.Drawing.Image zoomImg = new Bitmap((int)(emf.Size.Width * 2), (int)(emf.Size.Height * 2));
        using (Graphics g = Graphics.FromImage(zoomImg))
        {
            g.ScaleTransform(2.0f, 2.0f);
            g.DrawImage(emf, new Rectangle(new Point(0, 0), emf.Size), new Rectangle(new Point(0, 0), emf.Size), GraphicsUnit.Pixel);
        }

        imgImagen.Save("convertToBmp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
        System.Diagnostics.Process.Start("convertToBmp.bmp");
        emf.Save("convertToEmf.png", System.Drawing.Imaging.ImageFormat.Png);
        System.Diagnostics.Process.Start("convertToEmf.png");
        zoomImg.Save("convertToZoom.png", System.Drawing.Imaging.ImageFormat.Png);
        System.Diagnostics.Process.Start("convertToZoom.png");
    }

JORGEMAL
 
Posts: 9
Joined: Fri Jan 10, 2014 5:18 pm

Fri Feb 09, 2018 2:29 am

Dear JORGEMAL,

Thanks for your inquiry.
Did you deploy your project on Azure ?
Firstly, we suggest you use the latest Spire.PDF Pack(Hot Fix) Version:4.2.0 which has all fixes to check if the issue is solved. If it still happens, please provide us with your input PDF for further investigation.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Feb 09, 2018 2:59 pm

I am NOT deploying to Azure. I am testing in my PC.
Please note that I am using Spire.PDF Community Edition (Free Spire.PDF for .NET) which is version 3.2 according to the download page (https://www.e-iceblue.com/Download/down ... -free.html)

Does the hot fix apply for this edition?
If so, should I apply only the "Hot Fix"?

Best regards,
Jorge Maldonado

JORGEMAL
 
Posts: 9
Joined: Fri Jan 10, 2014 5:18 pm

Sun Feb 11, 2018 6:31 am

Dear Jorge,

Thanks for your feedback.
The hotfix will not be applied for the free edition. The link I provided before is the link of commercial version. And sorry currently we don't have the plan to maintain the free version. All fixes and new features are only included in commercial version, so please try to use the latest commercial Spire.PDF Pack(Hot Fix) Version:4.2.4. If the issue still happens, could you please provide us with your input PDF for further investigation ?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Feb 13, 2018 8:28 am

Dear Jorge,

Greetings from E-iceblue.
How is your issue now ? Could you please give us some feedback at your convenience ?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Feb 13, 2018 8:17 pm

My interest is for the free version for now, so I will look for another solution.

Thank you.

JORGEMAL
 
Posts: 9
Joined: Fri Jan 10, 2014 5:18 pm

Wed Feb 14, 2018 1:43 am

Dear Jorge,

Thanks for your feedback.
If you have other questions, welcome to contact us.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF

cron