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 Aug 20, 2020 12:34 pm

Hello,

Im creating big PDF files with large amount of buttons. When opening this files in Adobe Acrobat I have problem with broken form fields. Adobe is trying to fix these fields and it takes very long time. To see process of "Fixing up form fields" by Adobe, firstly open adobe and then from menu File - > Open. Small window will appear on bottom right side of adobe window.

Here is example code that I use to create pdf:
Code: Select all
 class Program
    {
        static void Main(string[] args)
        {
            var tw = new TestButtons();
            tw.CreatePdf();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
    }
    public class TestButtons
    {
        private readonly PdfNewDocument document;

        public TestButtons()
        {
            document = new PdfNewDocument();
        }

        public void CreatePdf()
        {

            for (int i = 1; i <= 1000; i++)
            {
                Console.WriteLine($"Creating page {i}");
                CreatePage(i);
            }

            var path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string resultPath = Path.Combine(path, $"TestButtons.pdf");
            document.Save(resultPath);

        }

        private void CreatePage(int insertIndex)
        {
            var page = document.Pages.Insert(insertIndex, new Size(500, 500), new PdfMargins(0f));
            for (int i = 1; i < 10; i++)
            {
                var btn = new PdfButtonField(page, $"{insertIndex}.{i}")
                {
                    Bounds = new RectangleF(10, 10 + (26 * i), 25, 25),
                    HighlightMode = PdfHighlightMode.NoHighlighting,
                    BorderWidth = 1,
                    BorderColor = new PdfRGBColor(Color.Red),
                    BackColor = new PdfRGBColor(Color.Transparent),
                    ForeColor = new PdfRGBColor(Color.Red),
                    ToolTip = "Tooltip",
                    Text = "Test "

                };
                document.Form.Fields.Add(btn);
            }
        }
    }


In my real output PDFs I use way more buttons to navigate between and it takes much more time to fix form fields by Adobe Acrobat.

If i dont add buttons to Form.Fields then Adobe is not fixing anything during opening but then i have two other issues:
Problem 1 - finding elements by name in java script takes long time i.e
var f = this.getField('buttonName');
and time is increased with number of pages, fields on pages 4000 and higher takes even about 30 seconds to find and in this time Adobe Acrobat is not responding.
Problem 2 - Using option "Save As" in Adobe acrobat for created document will save new document without any buttons (fields) .

System Information:
Im using newest Spire PDF for .Net
Adobe Acrobat Reader DC Version 2020.012.20043
Windows 10 64 bit

DOw
 
Posts: 5
Joined: Thu Jul 04, 2019 10:31 am

Fri Aug 21, 2020 8:38 am

Hello,

Thanks for your inquiry.
I tested your code with the latest Spire.PDF Pack(Hot Fix) Version:6.8.1, but the form fields of the generated PDF were not broken. And I used option "Save As" in Adobe to save a new document, but the form fields still exist. This is my testing project, please run it directly and then let us know your test result.
Besides, regarding the “Problem 1”you mentioned, could you please describe it in more detail to help us better understand your issue? Thanks in advance.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri Aug 21, 2020 9:36 am

Hello,

I tried to open your test project but it seems that no project files are included inside.

Here is my example PDF file created with Spire PDF 6.8.1
TestButtons.zip

Please try to use similar version of acrobat
About Adobe Acrobat Reader DC 20.0.png

Firstly open Adobe Acrobat and then drag PDF file on it, then please look at the bottom of window:
2020-08-21 11_06_56-Adobe Acrobat Reader DC.png

Problem with Adobe fixing fields was already confirmed by one of Spire PDF members long time ago. I wrote about this private emails with support (Email had title #19671, and the person name Betsy Jiang), but now i keep getting another problems that seems to be associated with this bug.

Problem 1 which I described is happening only if I don't add buttons to Fields collection. So in my implementation right now i have following situation:
- if i don't add buttons to fields collection then PDF will open fast in Adobe, but finding elements in document will take long time by java script
- if i add buttons to fields collection then PDF will open with long delay, but finding elements in document will be fast.

It is very important for me to finish the implementation and i need Form.Fields to work correctly.

DOw
 
Posts: 5
Joined: Thu Jul 04, 2019 10:31 am

Mon Aug 24, 2020 3:35 am

Hello,

Thanks for your feedback and sorry for the late reply as weekend.
I’m very sorry that the demo uploaded before is incomplete due to network problems. Now I have re-uploaded the complete project.

I followed what you said and opened the generated PDF document with the same version of Adobe as you, and I did get the prompt message "Fixing up form fields". This issue has been logged in our bug tracking system with the ticket SPIREPDF-3531 for further investigation. We will let you know if there is any update.
Apologize for the inconvenience caused.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Mon Aug 24, 2020 6:31 am

Hello,

I have tested your project. I have same issue with fixing up form fields in result pdf.
I have tried to open this pdf on multiple different PCs and everywhere I get same problem.

DOw
 
Posts: 5
Joined: Thu Jul 04, 2019 10:31 am

Mon Aug 24, 2020 7:50 am

Hello,

Yes, when testing the project I provided, I followed the operation you said to open the output file, I also encountered the same issue. However, I found that if I double-click the file to open it, the prompt message will not appear, but it will take a little longer to fully open the file.
Anyway, this issue has been posted to our Dev team and they will do more investigation. We will keep you informed if there is any update.

Sincerely,
Elena,
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri Sep 18, 2020 3:01 am

Hello,

I just got news from our Dev team that your issue has been resolved! The fix will be included in the next version of Spire.Pdf.
Once the new version is available, we will inform you ASAP. Thanks for your patience.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Mon Sep 28, 2020 9:33 am

Hello,

Hope you are doing well.
Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:6.9.16 which fixes your issue. Welcome to download it from the following links.
Our website: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget: https://www.nuget.org/packages/Spire.PDF/6.9.16

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Tue Oct 06, 2020 7:50 am

Hello,

Thank you for letting me know about new Spire PDF release.

The issue has been fixed but with the new version new things came out. Size of the PDF is much larger now and the time of saving document is twice as long as before.

Example:

File one had 1,5 Mb when creating it with old Spire PDF (5.6), but with new version its 2,5 Mb. Creation time difference is not visible.
File two had 440 Mb when creating it with old Spire PDF (5.6), but with new version its 675 Mb. Creation time increased from 24 min to 48 min.


To have better imagionation of what files im creating, i will add that file one contains 1000 form fields and file two contains 214000 fields. All of the form fields are type of "PdfButtonField".
Is there any chance that the size and performance could be improved? It have very big impact on performance of whole process in my project.

DOw
 
Posts: 5
Joined: Thu Jul 04, 2019 10:31 am

Tue Oct 06, 2020 9:27 am

Hi,

Thanks for your feedback.
I tested your case and found that the cause of the large size and long time issue is the code document.Form.NeedAppearances = false. Below are my testing results.
1) Test case 1: Creating PDF with 1000 pages. Before setting the code, my application took 13 seconds and the generated PDF size is 5mb. After setting, it took 20 seconds and the size is 9.8mb.
2) Test case 2: Creating PDF with 10000 pages. Before setting the code, my application took 552 seconds and the generated PDF size is 52mb. After setting, it took 690 seconds and the size is 99mb.
I have posted this behavior to our dev team to further investigate if there is any optimization regarding the size and time could be made. If there is any update for you, I will inform you immediately. Sorry for the inconvenience caused.

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