"Preserve Extended Rights" with Flatten fields

Hi Guys,


I’ve been following the Preserve Extended Rights article and have developed the following code:

var fs = new FileStream(“W8BEN.pdf”, FileMode.Open, FileAccess.ReadWrite);
var pdfDocument = new Document(fs);
//get values from all fields
foreach (Field formField in pdfDocument.Form)
{
// if the fullname of field contains A1, perform the operation
if (formField.FullName.Contains(“f1-1”))
{
// Cast form field as TextBox
TextBoxField textBoxField = formField as TextBoxField;
// modify field value
textBoxField.Value = “Testing”;
}
}
// flatten form
pdfDocument.Form.Flatten();
// save the doc
pdfDocument.Save();
// close the File Stream object
fs.Close();

Once I’ve filled in the form I want to flatten the document so that it cannot be edited electronically and must be printed first. To that end I am calling pdfDocument.Form.Flatten().

When opening the resulting PDF I receive the message “This document enabled extended features in Adobe Reader. The document has been changed since it was created and use of extended features is no longer available. Please contact Author”

How do I flatten the fields and remove this message. If I do not flatten the fields I do not get the warning (but that leaves the fields enabled which is not the desired output)

Many thanks,

James

Hi James,


Thanks for contacting support.

Can you please share the source PDF file so that we can test the scenario at our end. We are sorry for this inconvenience.

Hi Nayyer,


The form in question is the lovely W8BEN form from the IRS, we’re aiming to complete the top half - ‘Part 1’. See attached for the copy we are using (supplied by them.)

Many thanks,

James

Hi James,


Thanks for sharing your source document. I've managed to reproduce the issue at my end and logged it as PDFNEWNET-35108 in our bug tracking system for further investigation and resolution. You will be notified via this thread as soon as it is resolved.


Sorry for the inconvenience faced.

<span style=“font-size:10.0pt;line-height:115%;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>

<span style=“font-size:10.0pt;line-height:115%;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>
Best Regards,