Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / HasXFAFormFields Method

HasXFAFormFields Method (GdPicturePDF)

In This Topic
Returns if the currently loaded PDF document contains XFA form fields.

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
'Declaration
 
Public Function HasXFAFormFields() As Boolean
public bool HasXFAFormFields()
public function HasXFAFormFields(): Boolean; 
public function HasXFAFormFields() : boolean;
public: bool HasXFAFormFields(); 
public:
bool HasXFAFormFields(); 

Return Value

true if the currently loaded PDF document contains XFA form fields, otherwise false. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Please be aware that we do not support this format now and we will never support it in the future as it is not standardized and has been excluded from the PDF Reference.

Example
How to find out if the PDF document contains XFA forms.
Dim caption As String = "Example: HasXFAFormFields"
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
            MessageBox.Show("This PDF document contains XFA forms, you may encounter potential rendering problems.", caption)
        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: HasXFAFormFields";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
    bool hasXFA = gdpicturePDF.HasXFAFormFields();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        if (hasXFA)
            MessageBox.Show("This PDF document contains XFA forms, you may encounter potential rendering problems.", 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