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.

Fri Nov 04, 2016 11:33 pm

When trying to convert a pdf to Jpg, I can set frameNumber = 1 and the second page will come back. but frameNumber = 0 the method kicks the CPU to 100% and never comes back. Contractually I cannot just attach the PDF but I could email it to you. This seems to only happen to one portion of our PDFs, but it locks up our entire system when one comes in, no exceptions are thrown by your code. It is like a while loop if running wild.

Code: Select all
 
            public static MemoryStream PullPage(FileInfo fileInfo, int frameNumber)
        {
            MemoryStream ms = new MemoryStream();
            if (File.Exists(fileInfo.FullName))
            {
                using (Spire.Pdf.PdfDocument doc = new PdfDocument())
                {
                    try
                    {
                        doc.LoadFromFile(fileInfo.FullName);
// this is where the code locks up and never comes back.
                        System.Drawing.Image bmp = doc.SaveAsImage(frameNumber, PdfImageType.Bitmap, 200, 200);
                        bmp.Save(ms, ImageFormat.Jpeg);
                    }
                    finally
                    {
                        doc.Close();
                    }
                }
            }
            return ms;
      }

lthurman
 
Posts: 1
Joined: Thu Oct 20, 2016 12:25 am

Mon Nov 07, 2016 2:42 am

Dear lthurman,

Sorry for late reply as weekend and thanks for your information.
Please send the file to us([email protected]) via email, and then we will investigate it and update to you.

Thanks,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.PDF