Print Page | Close Window

Flattening of XFA field

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2868
Printed Date: 29 Apr 24 at 5:16AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Flattening of XFA field
Posted By: toran
Subject: Flattening of XFA field
Date Posted: 14 Apr 14 at 7:35PM
I am using UpdateAndFlattenFormField method  to flatten XFA fields and the method is failing on some of them. Out of 80 fields (all have similar name structure) the method fails on 3 fields with the names:

"form1[0]"
"form1[0].#subform[6]"
"form1[0].#subform[7]"

Perhaps it also fails on other fields that are subfields of the above fields, but the return value indicate success.

What could be the problem?

Thanks.




Replies:
Posted By: Ingo
Date Posted: 20 Apr 14 at 5:13PM
I think ...
"form1[0]"
"form2[0].#subform1[6]"
"form3[0].#subform2[7]"
... would work.
It's only an idea regarding on similar posts from the past. ;-)

Cheers, Ingo



-------------
Cheers,
Ingo



Posted By: toran
Date Posted: 22 Apr 14 at 2:15AM
Well, the field names that I posted are returned by QPDF Api. Are you suggesting a QPDF bug in processing field names ?


Posted By: Ingo
Date Posted: 22 Apr 14 at 7:22AM
no... i only know from the past that it could be difficult dealing with form fields having identical names.
With QuickPDF it's possible to rename fields on the fly while/before processing...
 
Cheers, Ingo


-------------
Cheers,
Ingo



Posted By: AndrewC
Date Posted: 22 Apr 14 at 1:43PM
Toran,

UpdateAndFlattenFormField is not designed to flatten XFA fields.  Adobe uses a strange system where it creates FormFields to match the entries in the XFA XML field description.  When the xml is updated it will update the dummy formfield attached to the XFA field so it is not a reliable method to flatten XFA fields.

You can call QP.RemoveXFAEntries to remove the XFA and leave the Acroform fields then you can use SetFormFieldValue to set the formfield.

Here is the code you need to use

            QP.LoadFromFile("i-9.pdf", "");
            QP.RemoveUsageRights();
            QP.RemoveXFAEntries(0);

            for (int i = QP.FormFieldCount(); i >= 1; i--)
            {
                QP.SetFormFieldValue(i, "111");
                QP.UpdateAndFlattenFormField(i);
            }
            QP.SetNeedAppearances(0);  // Stop Acrobat asking to save the file when closing.

            QP.SaveToFile("out.pdf");

Andrew



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk