PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

AcroForm Flattening?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3395
Page 1 of 1

Author:  claymon [ Tue Jul 19, 2016 3:51 pm ]
Post subject:  AcroForm Flattening?

Hey,

Is there a way to "flatten" an AcroForm after the fields have been filled with values? I am using v1.50.4000-beta3b. I can seem to enumerate the fields in the AcroForm.Fields collection just fine and assign the values (e.g. pdfDoc.AcroForm.Fields["producer_addr_1"].Value = new PdfString("Hello World");). I can also save the pdf document fine. The only thing is when I open the new saved pdf the AcroForms are still showing in the document and they are hiding the actual filled in values. If I click on a field I can see the value has been set. How would we tell the doc to essentially "flatten" the AcroForm so it is no longer seen? I tried setting the field ReadOnly value to true and while that removed the form field is also hides the value.

Could not attach form we are working with as you only allow 256k.

Thanks!

Author:  claymon [ Tue Jul 19, 2016 4:24 pm ]
Post subject:  Re: AcroForm Flattening?

And right after I post I find a solution that seems to work so far.

Needed to add this before I updated the field values

if (pdfDoc.AcroForm.Elements.ContainsKey("/NeedAppearances"))
{
pdfDoc.AcroForm.Elements["/NeedAppearances"] = new PdfBoolean(true);
}
else
{
pdfDoc.AcroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));
}

Found it here: http://stackoverflow.com/questions/6240 ... orm-fields

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/