GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / FlattenFormFields Method / FlattenFormFields() Method
Example





In This Topic
FlattenFormFields() Method
In This Topic
Flattens all form fields included in the currently loaded PDF document.

Flattening form fields means removing the form field objects from the document's internal structure and placing their data within the PDF document as regular items, so the previously defined form fields are no longer fillable or available for user's interaction.

Syntax
'Declaration
 
Public Overloads Function FlattenFormFields() As GdPictureStatus
public GdPictureStatus FlattenFormFields()
public function FlattenFormFields(): GdPictureStatus; 
public function FlattenFormFields() : GdPictureStatus;
public: GdPictureStatus FlattenFormFields(); 
public:
GdPictureStatus FlattenFormFields(); 

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
Flattening all form fields included in the current document.
Using gdpicturePdf As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("document.pdf", False)
    gdpicturePDF.FlattenFormFields()
    MessageBox.Show("The number of form fields available: " + gdpicturePDF.GetFormFieldsCount(), "Flattening form fields", MessageBoxButtons.OK, MessageBoxIcon.Information)
    gdpicturePDF.SaveToFile("output.pdf")
End Using
using (GdPicturePDF gdpicturePdf = new GdPicturePDF())
{
    gdpicturePDF.LoadFromFile("document.pdf", false);
    gdpicturePDF.FlattenFormFields();
    MessageBox.Show("The number of form fields available: " + gdpicturePDF.GetFormFieldsCount(), "Flattening form fields", MessageBoxButtons.OK, MessageBoxIcon.Information);
    gdpicturePDF.SaveToFile("output.pdf");
}
See Also