CheckPDFAConformance(PdfValidationConformance,String) Method
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.
- 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
true if currently loaded document is Valid PDF/A document, otherwise returns false. The
GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Example
How to check if document conforms to specified PDF/A standard.
Dim caption As String = "Example: CheckPDFAConformance"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim XMLReport As String = String.Empty
Dim IsValid As Boolean = gdpicturePDF.CheckPDFAConformance(PdfValidationConformance.PDF_A_2b, XMLReport)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If IsValid Then
MessageBox.Show("The PDF document conforms to specified PDF/A standard.", caption)
Else
MessageBox.Show("The PDF document does not conform to specified PDF/A standard. Refer to the XML Report for further details.", caption)
End If
Else
MessageBox.Show("Error occurred 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 gdpicturePDF = new GdPicturePDF())
{
string caption = "Example: CheckPDFAConformance";
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string XMLReport = string.Empty;
bool isValid = gdpicturePDF.CheckPDFAConformance(PdfValidationConformance.PDF_A_2b, ref XMLReport);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if(isValid)
{
MessageBox.Show("The PDF document conforms to specified PDF/A standard.", caption);
}
else
{
MessageBox.Show("The PDF document does not conform to specified PDF/A standard. Refer to the XML Report for further details.", caption);
}
}
else
{
MessageBox.Show("Error occurred durring the document validation process. Status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
}
Example
How to check if document conforms to specified PDF/A standard.
Dim caption As String = "Example: CheckPDFAConformance"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim XMLReport As String = String.Empty
Dim IsValid As Boolean = gdpicturePDF.CheckPDFAConformance(PdfValidationConformance.PDF_A_2b, XMLReport)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If IsValid Then
MessageBox.Show("The PDF document conforms to specified PDF/A standard.", caption)
Else
MessageBox.Show("The PDF document does not conform to specified PDF/A standard. Refer to the XML Report for further details.", caption)
End If
Else
MessageBox.Show("Error occurred 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 gdpicturePDF = new GdPicturePDF())
{
string caption = "Example: CheckPDFAConformance";
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
string XMLReport = string.Empty;
bool isValid = gdpicturePDF.CheckPDFAConformance(PdfValidationConformance.PDF_A_2b, ref XMLReport);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if(isValid)
{
MessageBox.Show("The PDF document conforms to specified PDF/A standard.", caption);
}
else
{
MessageBox.Show("The PDF document does not conform to specified PDF/A standard. Refer to the XML Report for further details.", caption);
}
}
else
{
MessageBox.Show("Error occurred durring the document validation process. Status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
}
See Also