PTPDFACompliance

@interface PTPDFACompliance : NSObject

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 analyzes 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/2/3) 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
  • Perform PDF/A validation or PDF/A conversion on the input PDF document.

    @exception. Throws an exception if the file can’t be opened.

    Declaration

    Objective-C

    - (instancetype)initWithConvert:(BOOL)convert
                          file_path:(NSString *)file_path
                           password:(NSString *)password
                               conf:(PTConformance)conf
                         exceptions:(int)exceptions
                     num_exceptions:(int)num_exceptions
                       max_ref_objs:(int)max_ref_objs
                         first_stop:(BOOL)first_stop;

    Swift

    init!(convert: Bool, file_path: String!, password: String!, conf: PTConformance, exceptions: Int32, num_exceptions: Int32, max_ref_objs: Int32, first_stop: Bool)

    Parameters

    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 SaveAs() method(s).

    file_path

    - pathname to the file.

    password

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

    conf

    The PDF conformance level. The default value is e_Level1B.

    max_ref_objs

    The maximum number of object references per error condition.

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithConvert: (BOOL)convert file_path:  (NSString *)file_path password:  (NSString *)password conf:  (PTConformance)conf exceptions:  (int)exceptions num_exceptions:  (int)num_exceptions max_ref_objs:  (int)max_ref_objs;

    Swift

    init!(convert: Bool, file_path: String!, password: String!, conf: PTConformance, exceptions: Int32, num_exceptions: Int32, max_ref_objs: Int32)
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithConvert: (BOOL)convert buf:  (NSData *)buf buf_size:  (unsigned long)buf_size password:  (NSString *)password conf:  (PTConformance)conf exceptions:  (int)exceptions num_exceptions:  (int)num_exceptions max_ref_objs:  (int)max_ref_objs first_stop:  (BOOL)first_stop;

    Swift

    init!(convert: Bool, buf: Data!, buf_size: UInt, password: String!, conf: PTConformance, exceptions: Int32, num_exceptions: Int32, max_ref_objs: Int32, first_stop: Bool)
  • Serializes the converted PDF/A document to a file on disk.

    Note

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

    Declaration

    Objective-C

    - (void)SaveAsFile:(NSString *)file_path linearized:(BOOL)linearized;

    Swift

    func save(asFile file_path: String!, linearized: Bool)

    Parameters

    file_path

    - the output file name.

    linearized

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

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

    Note

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

    Declaration

    Objective-C

    - (void)SaveAs:(NSString *)file_path;

    Swift

    func save(as file_path: String!)

    Parameters

    linearized

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

    Return Value

    The converted document saved as a memory buffer.

  • Undocumented

    Declaration

    Objective-C

    - (NSData*)SaveAsMemBuf: (BOOL)linearized;

    Swift

    func save(asMemBuf linearized: Bool) -> Data!
  • Declaration

    Objective-C

    - (unsigned long)GetErrorCount;

    Swift

    func getErrorCount() -> UInt

    Return Value

    The number of compliance violations.

  • @exception throws an Exception if the index is outside the array bounds.

    Declaration

    Objective-C

    - (PTErrorCode)GetError:(unsigned long)idx;

    Swift

    func getError(_ idx: UInt) -> PTErrorCode

    Parameters

    idx

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

    Return Value

    The error identifier.

  • Declaration

    Objective-C

    - (unsigned long)GetRefObjCount:(PTErrorCode)id;

    Swift

    func getRefObjCount(_ id: PTErrorCode) -> UInt

    Parameters

    id

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

    Return Value

    The number of object references associated with a given error.

  • @exception throws an Exception if the index is outside the array bounds.

    Declaration

    Objective-C

    - (unsigned long)GetRefObj:(PTErrorCode)id err_idx:(unsigned long)err_idx;

    Swift

    func getRefObj(_ id: PTErrorCode, err_idx: UInt) -> UInt

    Parameters

    id

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

    err_idx

    The index in the array of object references. The array is indexed starting from zero.

    Return Value

    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.

  • Declaration

    Objective-C

    + (NSString *)GetPDFAErrorMessage:(PTErrorCode)id;

    Swift

    class func getPDFAErrorMessage(_ id: PTErrorCode) -> String!

    Parameters

    id

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

    Return Value

    A descriptive error message for the given error identifier.

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

    Declaration

    Objective-C

    + (PTConformance)GetDeclaredConformance:(PTPDFDoc *)in_doc;

    Swift

    class func getDeclaredConformance(_ in_doc: PTPDFDoc!) -> PTConformance

    Parameters

    in_doc

    the document

    Return Value

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