logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Alex  
#1 Posted : Thursday, April 22, 2021 11:02:15 PM(UTC)
Alex

Rank: Newbie

Groups: Registered
Joined: 3/21/2021(UTC)
Posts: 5
Australia
Location: Sydney

Thanks: 1 times
Hi,
Hope someone here can help me.
Recently we upgraded Pdfium SDK from 4.6.2704 to 4.51.2704 and immediately noticed a performance difference between the versions.

We have a pdf file with 728 PdfControls in total, spread across 20 pages.
Once the file is loaded, we enumerate all controls on each page, and then for each control we access the Field property to obtain FieldType, FullName, etc as shown below:


Code:
        
        FormFieldTypes[] SupportedFieldTypes = { ... };

        public void GetPdfPageInfo(PdfDocument doc)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();

            var pageControls = doc.Pages.Select(p => doc.FormFill.InterForm.GetPageControls(p)).ToList();
            var count = 0;

            foreach (var pageControl in pageControls)
            {
                foreach (var control in pageControl)
                {
                    var fieldFullName = control.Field.FullName;

                    if (SupportedFieldTypes.Contains(control.Field.FieldType))
                    {
                        var field = control.Field;
                    }

                    count++;
                }
            }

            stopWatch.Stop();
            var ts = stopWatch.Elapsed;
            Debug.WriteLine($"{ts.Minutes:00}:{ts.Seconds:00}:{ts.Milliseconds:000}");  // about 7 secs
            Debug.WriteLine($"{count}");    // Count:728
        }


When used with 4.51.2704, the above code takes about 7 secs to complete. However, in 4.6.2704 it was almost instantaneous.
Moreover, if we comment out line 14, the delay drops down to 4 secs, and without line 18 further down to 2 secs.

So every reference to the Field property substantially increases the execution time.
How can we work around this issue and get nearly instantaneous performance as it was before the upgrade?

Thanks in advance,
Alex.
Paul Rayman  
#2 Posted : Friday, April 23, 2021 2:32:31 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,018

Thanks: 5 times
Was thanked: 121 time(s) in 118 post(s)
Please email such PDF to support@patagames.com
Alex  
#3 Posted : Friday, April 23, 2021 2:39:23 AM(UTC)
Alex

Rank: Newbie

Groups: Registered
Joined: 3/21/2021(UTC)
Posts: 5
Australia
Location: Sydney

Thanks: 1 times
Originally Posted by: Paul Rayman Go to Quoted Post
Please email such PDF to support@patagames.com

Done. Thanks Paul!

Paul Rayman  
#4 Posted : Saturday, April 24, 2021 12:35:13 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,018

Thanks: 5 times
Was thanked: 121 time(s) in 118 post(s)
thanks 1 user thanked Paul Rayman for this useful post.
Alex on 4/27/2021(UTC)
Alex  
#5 Posted : Tuesday, April 27, 2021 11:18:54 PM(UTC)
Alex

Rank: Newbie

Groups: Registered
Joined: 3/21/2021(UTC)
Posts: 5
Australia
Location: Sydney

Thanks: 1 times
Thanks! The issue was resolved in Pdfium.Net.SDK 4.54.2704.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.