Trying to Retain Fill-in Fields

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v7)  /  Re: Trying to Retain Fill-in Fields

DynamicPDF CoreSuite for .NET (v7) Forum

 Apr 04 2016 2:55 PM
I'm using a MergeDocument v7 and trying to add data to a fill-in PDF but preserve the fields when I draw and serve it to the client.  Whether I set the Document.FormFlattening option to default or don't set it, the form is being flattened.  The only values available in FormFlatteningOptions are default and digital signatures.  How to I select to retain the fields?

I see that the syntax for flattening a form was updated for v8 but we use v7. 

Sample code:

document.Append("wh347.pdf", New MergeOptions(True))
'setting of fields
document.FormFlattening = FormFlatteningOptions.Default
document.Draw()

Thanks.
 Apr 04 2016 4:57 PM
Posted by a ceTe Software moderator

Hello,

Yes, in v8 we have updated the syntax for form flattening, but the functionality remains the same.

In v7, setting the FormFlattening option to default as shown below will flatten all form fields including the signature fields.

document.FormFlattening = FormFlatteningOptions.Default

Setting the FormFlattening option to retain digital signatures as shown below will flatten all form fields excluding the digital signature fields.

document.FormFlattening = FormFlatteningOptions.RetainDigitalSignatures

Do not set the document.FormFlattening at all in your code to retain (not flatten) all form fields.

Thanks,
ceTe Software Support Team.

 Apr 05 2016 10:06 AM
Thanks for the reply.  That's what I would expect to happen but that's not the results I'm getting.  As I said, whether I set the form flatten option of not, the form is being flattened. 

I had version 7.0.1 and have now updated to 7.0.3 thinking maybe something was fixed in a later version.  Now I get an "Object reference not set to an instance of an object" exception when I try to append the form to my document and give it a rootFormField name.  If I don't use the rootFormField, it does append the form but it is still flattened.

My code is as follows:

      Dim document As New MergeDocument
      document.Append("wh347.pdf", New MergeOptions(True, "Page1"))
      Return document.Draw()

The PDF form I'm using is a standard Dept. of Labor form found at
http://www.dol.gov/whd/forms/wh347.pdf

Thanks for any help.
 Apr 05 2016 4:28 PM
Posted by a ceTe Software moderator
Hello,

We are able to recreate the "Object reference not set to an instance of an object" exception while specifying the rootFormField parameter. This error only happens with the specific PDF you provided. We are looking into this issue it further and will post an update as soon as we are done with our analysis.

We tested both v7.0.1 & 7.0.3 with the following code (without rootFormField parameter) and we are able to fill & save the PDF with form fields retained.

      Dim document As New MergeDocument
      document.Append("wh347.pdf", New MergeOptions(True))
      ‘fill form fields
      document.Form.Fields["contractor"].Value = "test"
      document.Draw(“output.pdf”)

Please double-check your code and make sure that you are not modifying the PDF in any way after the Draw method generates it. Also try the above four lines of code and save the PDF to disk directly and let us know if that retains the form fields. If the form fields are still not retained then email us (support@cete.com) the output PDF.


Thanks,
ceTe Software Support Team.
 Apr 05 2016 5:01 PM
Thank you!

When I saved the resulting PDF to my computer and opened it, it had retained the fields.  I've been testing and viewing the PDF in Firefox and realize now that the PDF viewer in Firefox was not supporting the fields.  When I test in Chrome it works perfectly.

I have gone back to 7.0.1 for now to avoid the error on merging.  The PDF does have some computed fields that might be causing the problem.  They are not working in 7.0.1 either but I can replace them with fill-in fields and handle the calculations in code if needed.

I appreciate that you would take the time to go back and fix the problem in v7 when you have changed the process in v8.  That means a lot to me as a developer.

Thanks. 
 Apr 06 2016 3:25 PM
Posted by a ceTe Software moderator
Hello,

Yes, Firefox’s default PDF viewer does not have the capability to display PDF form fields. Regarding the error, we will let you know once we analyze it further. Typically issues are first fixed in the current version (v8). We will take your request into consideration. However, please keep in mind that fixing an issue in older versions may not be possible all the time as it depends of a lot of different factors.

Thanks,
ceTe Software Support Team.
 Jan 30 2017 9:33 AM
Posted by a ceTe Software moderator
Hello,

The latest build of v8 includes a fix for this issue and is available for download here.

As per your request we were able to fix the issue in v7 as well. Please email our support team (support@cete.com) and refer to this forum thread to obtain a v7 fix.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 3:19 AM.