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.

Sat Feb 10, 2018 5:06 pm

Hi there,
I found another problem that Spire.PDF hang when extracting images. No error is thrown, the application stays on ExtractImages forever. I created this as a separate thread with the ExtractText() issue so it is easier to follow. The environment is
- Window 10, Australia/English
- Spire.PDF version 4.2.4
- PDF file
hang ocr-9e0f63cd-2a3c-4cd8-9f85-93db0aabcbde.rar

- Code
Code: Select all
           //Instantiate an object of Spire.Pdf.PdfDocument
            PdfDocument doc = new PdfDocument();
            //Load a PDF file
            doc.LoadFromFile("../../PDFs/crashed service/hang ocr-9e0f63cd-2a3c-4cd8-9f85-93db0aabcbde.pdf");

            List<Image> ListImage = new List<Image>();
            for (int i = 0; i < doc.Pages.Count; i++)
            {
                // Get an object of Spire.Pdf.PdfPageBase
                PdfPageBase page = doc.Pages[i];
                // Extract images from Spire.Pdf.PdfPageBase
                Image[] images = page.ExtractImages(); //hang here
                if (images != null && images.Length > 0)
                {
                    ListImage.AddRange(images);
                }
            }
            if (ListImage.Count > 0)
            {
                for (int i = 0; i < ListImage.Count; i++)
                {
                    Image image = ListImage[i];
                    image.Save("image" + (i + 1).ToString() + ".png", System.Drawing.Imaging.ImageFormat.Png);
                }
                System.Diagnostics.Process.Start("image1.png");
            }

            //extract text
            StringBuilder content = new StringBuilder();
            foreach (PdfPageBase page in doc.Pages)
                content.Append(page.ExtractText());
            var text = content.ToString();


Can you please investigate?

Cheers,
Tung

tungnguyen
 
Posts: 8
Joined: Fri Feb 09, 2018 3:20 am

Sun Feb 11, 2018 2:53 am

Dear Tung,

Thanks for your inquiry.
I have reproduced the issue on my side and logged it into our bug tracking system. If it is fixed or there are some updates, we will let you know. We apologize for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

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

Sun Feb 11, 2018 1:26 pm

Great. Thanks.

Cheers,
Tung

tungnguyen
 
Posts: 8
Joined: Fri Feb 09, 2018 3:20 am

Thu Feb 22, 2018 10:33 pm

Is there any update on this issue? I'm running into the same issue on both the ExtractText and SaveAsImage methods.

help@redbellre.com
 
Posts: 7
Joined: Mon May 08, 2017 9:04 pm

Fri Feb 23, 2018 5:44 am

Hello,

Thanks for your waiting. The issue has get resolved, and now it is in the testing phase, once the hotfix is available, we will let you know immediately.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Feb 26, 2018 7:42 am

Dear Tung,

Thanks for your waiting.
Glad to inform you the hotfix is available. Please download it from this link: Spire.PDF Pack(Hot Fix) Version:4.2.8.

Sincerely,
Nina
E-iceblue support team
User avatar

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

Mon Feb 26, 2018 8:36 am

Great. Thanks for the quick fix.

tungnguyen
 
Posts: 8
Joined: Fri Feb 09, 2018 3:20 am

Tue Feb 27, 2018 8:01 am

Hello,

Greetings from E-iceblue.
Did you test the hotfix?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

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

Thu Mar 15, 2018 4:58 pm

I tested the hotfix however it did not resolve my issue. I have a sample I can send you but it has sensitive data in it. Is there an email address i can send it to you directly?

Also, i tested the hotfix using the latest version of Spire.PDF, however i'm using the Spire.Office version for my production site and will need it to work there as well.

help@redbellre.com
 
Posts: 7
Joined: Mon May 08, 2017 9:04 pm

Fri Mar 16, 2018 2:12 am

Hello Redbellre,

Thanks for your feedback. Please send your sample to support@e-iceblue.com. Once we resolve your issue, we will add the hotfix to Spire.Office and let you know.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Mar 19, 2018 8:30 pm

I sent two examples. Can you please confirm that you've received them?

help@redbellre.com
 
Posts: 7
Joined: Mon May 08, 2017 9:04 pm

Tue Mar 20, 2018 2:06 am

Hello,

Thanks for your sharing. We have received your email.
After an initial test with Spire.PDF Pack(Hot Fix) Version:4.3.4, I was unable to reproduce the issue. Please refer to my test code and use the new version to have a try.
Code: Select all
            Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
            doc.LoadFromFile(@"C:\Users\Administrator\Desktop\13228\3421568-3-Hud2.pdf");

            List<Image> ListImage = new List<Image>();
            for (int i = 0; i < doc.Pages.Count; i++)
            {
                // Get an object of Spire.Pdf.PdfPageBase
                PdfPageBase page = doc.Pages[i];
                // Extract images from Spire.Pdf.PdfPageBase
                Image[] images = page.ExtractImages();

                if (images != null)
                {             
                    for (int j = 0; j < images.Length; j++)
                    {
                        images[j].Save("file" + i + "_" + j + ".png", System.Drawing.Imaging.ImageFormat.Png);
                    }
                }

            }


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Mar 20, 2018 6:37 pm

It’s not the ExtractImages method that’s causing trouble, it’s the SaveAsImage and ExtractText methods . Please attempt using your company's documentation here:

https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-PDF-Page-to-Image-with-C-code.html


Code: Select all
        static void Main(string[] args)
        {
            byte[] _bytes = File.ReadAllBytes(@"C:\TestFile.pdf");
            PdfDocument doc = new PdfDocument(_bytes);

            for (int i = 0; i < doc.Pages.Count; i++)
            {
                Debug.WriteLine($"Attempting to image page number {i}");
                Image bmp = doc.SaveAsImage(i);
            }
        }


https://www.e-iceblue.com/Knowledgebase/Spire.PDF/Program-Guide/How-to-Extract-Text-from-PDF-Document-with-C-/VB.NET.html

The same thing occurs while attempting to extract text:

Code: Select all
        static void Main(string[] args)
        {
            byte[] _bytes = File.ReadAllBytes(@"C:\TestFile.pdf");
            PdfDocument doc = new PdfDocument(_bytes);

            for (int i = 0; i < doc.Pages.Count; i++)
            {
                string text = doc.Pages[i].ExtractText();
                Debug.WriteLine($"Page Text: {text}");
            }
        }


Please let me know what you find.

help@redbellre.com
 
Posts: 7
Joined: Mon May 08, 2017 9:04 pm

Wed Mar 21, 2018 2:28 am

Hello Jeff,

Thanks for your information. I have noticed the issue and posted it to our DEV team. Once it's fixed, we will let you know. We apologize for the inconvenience.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon May 21, 2018 8:01 pm

Do you have an update on this issue? The problem continues to bring down our servers every time we happen across an impacted PDF.

help@redbellre.com
 
Posts: 7
Joined: Mon May 08, 2017 9:04 pm

Return to Spire.PDF

cron