GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / GetPDFAConformance Method
Example





In This Topic
GetPDFAConformance Method (GdPicturePDF)
In This Topic
Returns the PDF or PDF/A conformance of the currently loaded PDF document.

PDF/A is an ISO-standardized version of the PDF specialized for the digital preservation of electronic documents. It is a subset of the PDF standard which excludes those PDF features that give rise to concerns about security and the ability to archive documents long term.

Syntax
'Declaration
 
Public Function GetPDFAConformance() As PdfConformance
public PdfConformance GetPDFAConformance()
public function GetPDFAConformance(): PdfConformance; 
public function GetPDFAConformance() : PdfConformance;
public: PdfConformance GetPDFAConformance(); 
public:
PdfConformance GetPDFAConformance(); 

Return Value

A member of the PdfConformance enumeration. Returns standard PDF/A conformance levels and versions for the PDF/A compliant document. The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the GdPicturePDF.GetStat method to identify the specific reason for the method's failure, if any.

When a PDF/A file is created, the toolkit ensures that the fonts are embedded. If the fonts are not embedded, you don't have a valid PDF/A file. PDF/A validation tools will inform you if fonts have or have not been embedded.

Just to inform you that the method returns the value of the PdfConformance.PDF for common PDF document.

Example
How to determine the conformance to the PDF/A standard of the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("your_test_pdfa.pdf", False)
If status = GdPictureStatus.OK Then
    Dim oConformance As PdfConformance = gdpicturePDF.GetPDFAConformance()
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        MessageBox.Show("This PDF conforms to " + oConformance.ToString() + " standard.", "Example: GetPDFAConformance")
    Else
        MessageBox.Show("The GetPDFAConformance() method has failed with the status: " + status.ToString(), "Example: GetPDFAConformance")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: GetPDFAConformance")
End If
If gdpicturePDF.CloseDocument() <> GdPictureStatus.OK Then
    Return
End If
            
If gdpicturePDF.NewPDF(PdfConformance.PDF_A_1b) = GdPictureStatus.OK Then
    Dim oConformance As PdfConformance = gdpicturePDF.GetPDFAConformance()
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        MessageBox.Show("This PDF conforms to " + oConformance.ToString() + " standard.", "Example: GetPDFAConformance") 'Should be PDF_A_1b.
    Else
        MessageBox.Show("The GetPDFAConformance() method has failed with the status: " + status.ToString(), "Example: GetPDFAConformance")
    End If
Else
    MessageBox.Show("The new file can't be created.", "Example: GetPDFAConformance")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("your_test_pdfa.pdf", false);
if (status == GdPictureStatus.OK)
{
    PdfConformance oConformance = gdpicturePDF.GetPDFAConformance();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
        MessageBox.Show("This PDF conforms to " + oConformance.ToString() + " standard.", "Example: GetPDFAConformance");
    else
        MessageBox.Show("The GetPDFAConformance() method has failed with the status: " + status.ToString(), "Example: GetPDFAConformance");
}
else
{
    MessageBox.Show("The file can't be loaded.", "Example: GetPDFAConformance");
}
if (gdpicturePDF.CloseDocument() != GdPictureStatus.OK)
    return;
            
if (gdpicturePDF.NewPDF(PdfConformance.PDF_A_1b) == GdPictureStatus.OK)
{
    PdfConformance oConformance = gdpicturePDF.GetPDFAConformance();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
        MessageBox.Show("This PDF conforms to " + oConformance.ToString() + " standard.", "Example: GetPDFAConformance"); //Should be PDF_A_1b.
    else
        MessageBox.Show("The GetPDFAConformance() method has failed with the status: " + status.ToString(), "Example: GetPDFAConformance");
}
else
{
    MessageBox.Show("The new file can't be created.", "Example: GetPDFAConformance");
}
gdpicturePDF.Dispose();
See Also