Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / ValidatePDFA Method
A member of the PdfValidationConformance enumeration. Specifies the conformance level that the document shall be validated against.
Output parameter. Provides simple validation result. If output value is true the document does conform to the requested standard. Otherwise the output will value will be false.
Output parameter. Provides detailed validation result in machine readable XML report. If the file does not conform to the requested standard the XML report will summarize all problems that have been found durring the validation process.
Example





In This Topic
    ValidatePDFA Method (GdPicturePDF)
    In This Topic
    Validates the currently loaded PDF document against specified PDF/A standard and provides validation report.
    Syntax

    Parameters

    Conformance
    A member of the PdfValidationConformance enumeration. Specifies the conformance level that the document shall be validated against.
    ConformsToRequestedStandard
    Output parameter. Provides simple validation result. If output value is true the document does conform to the requested standard. Otherwise the output will value will be false.
    DetailedXMLOutput
    Output parameter. Provides detailed validation result in machine readable XML report. If the file does not conform to the requested standard the XML report will summarize all problems that have been found durring the validation process.

    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.

    Use PdfValidationConformance.Unknown in order to autodetect PDF/A conformance claimed by the validated document.

    Example
    How to validate if the document conforms to the PDF/A-2b requirements.
    Dim caption As String = "Example: ValidatePDFA"
    Using oGdPicturePDF As GdPicturePDF = New GdPicturePDF()
         Dim status As GdPictureStatus = oGdPicturePDF.LoadFromFile("test.pdf", False)
         If status = GdPictureStatus.OK Then
            Dim ConformsToRequestedStandard As Boolean = False
            Dim XMLReport As String = String.Empty
            status = oGdPicturePDF.ValidatePDFA(PdfValidationConformance.PDF_A_2b, ConformsToRequestedStandard, XMLReport)
            If status = GdPictureStatus.OK Then
                If ConformsToRequestedStandard Then
                    MessageBox.Show("The PDF document does conform to the PDF/A-2b standard.", caption)
                Else
                    MessageBox.Show("The PDF document does not conform to the PDF/A-2b standard. Refer to the XML Report for further details.", caption)
                End If
            Else
                MessageBox.Show("Error occured durring the document validation process. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
        End If
    End Using
    using (GdPicturePDF oGdPicturePDF = new GdPicturePDF())
    {
        string caption = "Example: ValidatePDFA";
        GdPictureStatus status = oGdPicturePDF.LoadFromFile("test.pdf", false);
        if (status == GdPictureStatus.OK)
        {
            bool ConformsToRequestedStandard = false;
            string XMLReport = string.Empty;
            status = oGdPicturePDF.ValidatePDFA(PdfValidationConformance.PDF_A_2b, ref ConformsToRequestedStandard, ref XMLReport);
            if (status == GdPictureStatus.OK)
            {
                if(ConformsToRequestedStandard)
                {
                    MessageBox.Show("The PDF document does conform to the PDF/A-2b standard.", caption);
                }
                else
                {
                    MessageBox.Show("The PDF document does not conform to the PDF/A-2b standard. Refer to the XML Report for further details.", caption);
                }
            }
            else
            {
                MessageBox.Show("Error occured durring the document validation process. Status: " + status.ToString(), caption);
            }
        }
        else
        {
            MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
        }
    }
    See Also