RemoveXFAFormFieldsData Method (GdPicturePDF)
In This Topic
Removes XFA form fields data resource for all form fields in currently loaded PDF document.
XFA stands for XML Forms Architecture, which is Adobe’s proprietary XML-based form technology and it has not been standardized in any public specification. With introducing the first version of PDF 2.0 as ISO-32000-2 published in May 2017, XFA entries have been officially excluded from this specification Therefore this format is not supported by GdPicturePDF and we will never support it in the future as well.
Please note that you may encounter potential rendering problems when viewing a PDF document with XFA forms using GdPicturePDF. Probably you will see this fallback message introduced by Adobe: "If this message is not eventually replaced by the proper content of the document, your PDF viewer may not be able to display this type of document."
Syntax
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Example
How to find out if the PDF document contains XFA forms and remove the data.
Dim caption As String = "Example: RemoveXFAFormFieldsData"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then
Dim hasXFA As Boolean = gdpicturePDF.HasXFAFormFields()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If hasXFA Then
If gdpicturePDF.RemoveXFAFormFieldsData() = GdPictureStatus.OK Then
MessageBox.Show("XFA form fields data has been successfully remove from the document.", caption)
Else
MessageBox.Show("The RemoveXFAFormFieldsData() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("This PDF document contains NO XFA forms.", caption)
End If
Else
MessageBox.Show("The HasXFAFormFields() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: RemoveXFAFormFieldsData";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
bool hasXFA = gdpicturePDF.HasXFAFormFields();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (hasXFA)
{
if(gdpicturePDF.RemoveXFAFormFieldsData() == == GdPictureStatus.OK)
{
MessageBox.Show("XFA form fields data has been successfully remove from the document.", caption)
}
else
{
MessageBox.Show("The RemoveXFAFormFieldsData() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
}
else
{
MessageBox.Show("This PDF document contains NO XFA forms.", caption);
}
}
else
MessageBox.Show("The HasXFAFormFields() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
Example
How to find out if the PDF document contains XFA forms and remove the data.
Dim caption As String = "Example: RemoveXFAFormFieldsData"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then
Dim hasXFA As Boolean = gdpicturePDF.HasXFAFormFields()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If hasXFA Then
If gdpicturePDF.RemoveXFAFormFieldsData() = GdPictureStatus.OK Then
MessageBox.Show("XFA form fields data has been successfully remove from the document.", caption)
Else
MessageBox.Show("The RemoveXFAFormFieldsData() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("This PDF document contains NO XFA forms.", caption)
End If
Else
MessageBox.Show("The HasXFAFormFields() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: RemoveXFAFormFieldsData";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
bool hasXFA = gdpicturePDF.HasXFAFormFields();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if (hasXFA)
{
if(gdpicturePDF.RemoveXFAFormFieldsData() == == GdPictureStatus.OK)
{
MessageBox.Show("XFA form fields data has been successfully remove from the document.", caption)
}
else
{
MessageBox.Show("The RemoveXFAFormFieldsData() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
}
else
{
MessageBox.Show("This PDF document contains NO XFA forms.", caption);
}
}
else
MessageBox.Show("The HasXFAFormFields() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
See Also