Show / Hide Table of Contents

Class PDFACompliance

PDFACompliance class is used to validate PDF documents for PDF/A (ISO 19005:1/2/3) compliance or to convert existing PDF files to PDF/A compliant documents.

The conversion option analyses the content of existing PDF files and performs a sequence of modifications in order to produce a PDF/A compliant document. Features that are not suitable for long-term archiving (such as encryption, obsolete compression schemes, missing fonts, or device-dependent color) are replaced with their PDF/A compliant equivalents. Because the conversion process applies only necessary changes to the source file, the information loss is minimal. Also, because the converter provides a detailed report for each change, it is simple to inspect changes and to determine whether the conversion loss is acceptable.

The validation option in PDF/A Manager can be used to quickly determine whether a PDF file fully complies with the PDF/A specification according to the international standard ISO 19005:1/2/3. For files that are not compliant, the validation option can be used to produce a detailed report of compliance violations as well as a list of relevant error objects.

Key Functions:

  • Checks if a PDF file is compliant with PDF/A (ISO 19005-1) specification.
  • Converts any PDF to a PDF/A compliant document.
  • Supports PDF/A-1a, PDF/A-1b, PDF/A-2b.
  • Produces a detailed report of compliance violations and associated PDF objects.
  • Keeps the required changes a minimum, preserving the consistency of the original.
  • Tracks all changes to allow for automatic assessment of data loss.
  • Allows user to customize compliance checks or omit specific changes.
  • Preserves tags, logical structure, and color information in existing PDF documents.
  • Offers automatic font substitution, embedding, and subsetting options.
  • Supports automation and batch operation. PDF/A Converter is designed to be used in unattended mode in high throughput server or batch environments
Inheritance
object
PDFACompliance
Implements
IDisposable
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: pdftron.PDF.PDFA
Assembly: PDFNet.dll
Syntax
public class PDFACompliance : IDisposable

Constructors

PDFACompliance(bool, byte[], string, Conformance, ErrorCode[], int, bool)

Perform PDF/A validation or PDF/A conversion on the input PDF document which is stored in a memory buffer.

Declaration
public PDFACompliance(bool convert, byte[] buf, string password, PDFACompliance.Conformance conf, PDFACompliance.ErrorCode[] exceptions, int max_ref_objs, bool first_stop)
Parameters
Type Name Description
bool convert

A flag used to instruct PDF/A processor to perform PDF/A conversion (if 'true') or PDF/A validation (if 'false'). After PDF/A conversion you can save the resulting document using Save() method(s).

byte[] buf

A memory buffer containing the serialized PDF document.

string password

An optional parameter that can be used to specify the password for encrypted PDF documents (typically only useful in the conversion mode).

PDFACompliance.Conformance conf

The PDF conformance level. The default value is e_Level1B.

ErrorCode[] exceptions

the exceptions

int max_ref_objs

The maximum number of object references per error condition.

bool first_stop

the first_stop

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFACompliance(bool, byte[], PDFAOptions)

Perform PDF/A validation or PDF/A conversion on the input PDF document which is stored in a memory buffer.

Declaration
public PDFACompliance(bool convert, byte[] buf, PDFAOptions in_options)
Parameters
Type Name Description
bool convert

A flag used to instruct PDF/A processor to perform PDF/A conversion (if 'true') or PDF/A validation (if 'false'). After PDF/A conversion you can save the resulting document using Save() method(s).

byte[] buf

A memory buffer containing the serialized PDF document.

PDFAOptions in_options

Options for PDFA processing

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFACompliance(bool, string, string, Conformance, ErrorCode[], int, bool)

Perform PDF/A validation or PDF/A conversion on the input PDF document.

Declaration
public PDFACompliance(bool convert, string filepath, string password, PDFACompliance.Conformance conf, PDFACompliance.ErrorCode[] exceptions, int max_ref_objs, bool first_stop)
Parameters
Type Name Description
bool convert

A flag used to instruct PDF/A processor to perform PDF/A conversion (if 'true') or PDF/A validation (if 'false'). After PDF/A conversion you can save the resulting document using Save() method(s).

string filepath

the file_path

string password

An optional parameter that can be used to specify the password for encrypted PDF documents (typically only useful in the conversion mode).

PDFACompliance.Conformance conf

The PDF conformance level. The default value is e_Level1B.

ErrorCode[] exceptions

the exceptions

int max_ref_objs

The maximum number of object references per error condition.

bool first_stop

the first_stop

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

PDFACompliance(bool, string, PDFAOptions)

Perform PDF/A validation or PDF/A conversion on the input PDF document.

Declaration
public PDFACompliance(bool convert, string filepath, PDFAOptions in_options)
Parameters
Type Name Description
bool convert

A flag used to instruct PDF/A processor to perform PDF/A conversion (if 'true') or PDF/A validation (if 'false'). After PDF/A conversion you can save the resulting document using Save() method(s).

string filepath

the file_path

PDFAOptions in_options

Options for PDFA processing

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Methods

Dispose()

Releases all resources used by the PDFACompliance

Declaration
public override sealed void Dispose()

Dispose(bool)

Declaration
[HandleProcessCorruptedStateExceptions]
protected virtual void Dispose(bool A_0)
Parameters
Type Name Description
bool A_0

~PDFACompliance()

Declaration
protected ~PDFACompliance()

GetDeclaredConformance(PDFDoc)

Retrieves whether document's XMP metadata claims PDF/A conformance and to what part and level.

Declaration
public static PDFACompliance.Conformance GetDeclaredConformance(PDFDoc in_doc)
Parameters
Type Name Description
PDFDoc in_doc

the document.

Returns
Type Description
PDFACompliance.Conformance

Presumptive PDFA part number and conformance level, as an enumerated value.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetError(int)

Gets the error.

Declaration
public PDFACompliance.ErrorCode GetError(int idx)
Parameters
Type Name Description
int idx

The index in the array of error code identifiers. The array is indexed starting from zero.

Returns
Type Description
PDFACompliance.ErrorCode

The error identifier.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetErrorCount()

Gets the error count.

Declaration
public int GetErrorCount()
Returns
Type Description
int

The number of compliance violations.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPDFAErrorMessage(ErrorCode)

Gets the pDFA error message.

Declaration
public static string GetPDFAErrorMessage(PDFACompliance.ErrorCode id)
Parameters
Type Name Description
PDFACompliance.ErrorCode id

error code identifier (obtained using GetError() method).

Returns
Type Description
string

A descriptive error message for the given error identifier.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetRefObj(ErrorCode, int)

Gets the ref obj.

Declaration
public int GetRefObj(PDFACompliance.ErrorCode id, int obj_idx)
Parameters
Type Name Description
PDFACompliance.ErrorCode id

error code identifier (obtained using GetError() method).

int obj_idx

the obj_idx

Returns
Type Description
int

A specific object reference associated with a given error type. The return value is a PDF object identifier (i.e. object number for 'pdftron.SDF.Obj)) for the that is associated with the error.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetRefObjCount(ErrorCode)

Gets the error.

Declaration
public int GetRefObjCount(PDFACompliance.ErrorCode id)
Parameters
Type Name Description
PDFACompliance.ErrorCode id

The index in the array of error code identifiers. The array is indexed starting from zero.

Returns
Type Description
int

The error identifier.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SaveAs(bool)

Serializes the converted PDF/A document to a memory buffer.

Declaration
public byte[] SaveAs(bool linearized)
Parameters
Type Name Description
bool linearized

An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized).

Returns
Type Description
byte[]

Byte array containing the serialized version of the document

Remarks

This method assumes that the first parameter passed in PDFACompliance constructor (i.e. the convert parameter) is set to 'true'.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SaveAs(Stream, bool)

Serializes the converted PDF/A document to a stream.

Declaration
public void SaveAs(Stream stm, bool linearized)
Parameters
Type Name Description
Stream stm

A stream where to serialize the document.

bool linearized

An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized).

Remarks

This method assumes that the first parameter passed in PDFACompliance constructor (i.e. the convert parameter) is set to 'true'.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SaveAs(string, bool)

Serializes the converted PDF/A document to a file on disk.

Declaration
public void SaveAs(string file_path, bool linearized)
Parameters
Type Name Description
string file_path

the file_path

bool linearized
  • An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized).
Remarks

This method assumes that the first parameter passed in PDFACompliance constructor (i.e. the convert parameter) is set to 'true'.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Implements

IDisposable
In this article
Back to top Generated by DocFX