PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 4:33 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: AcroForm Flattening?
PostPosted: Tue Jul 19, 2016 3:51 pm 
Offline

Joined: Tue Jul 19, 2016 3:38 pm
Posts: 2
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: AcroForm Flattening?
PostPosted: Tue Jul 19, 2016 4:24 pm 
Offline

Joined: Tue Jul 19, 2016 3:38 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 157 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group