pdftools_sdk.pdf_a.validation.validator

Module Attributes

ErrorFunc

Report a validation issue found in pdftools_sdk.pdf_a.validation.validator.Validator.analyze() or pdftools_sdk.pdf_a.validation.validator.Validator.validate() .

Classes

Validator()

The class to validate the standard conformance of documents

pdftools_sdk.pdf_a.validation.validator.ErrorFunc

Report a validation issue found in pdftools_sdk.pdf_a.validation.validator.Validator.analyze() or pdftools_sdk.pdf_a.validation.validator.Validator.validate() .

Parameters:
  • dataPart (Optional[str]) –

    The data part is None for the main file and a data part specification for embedded files.

    Examples:

    • embedded-file:file.pdf: For a file file.pdf that is embedded in the main file.

    • embedded-file:file1.pdf/embedded-file:file2.pdf: For a file file2.pdf that is embedded in an embedded file file1.pdf.

  • message (str) – The validation message

  • category (pdftools_sdk.pdf_a.validation.error_category.ErrorCategory) – The category of the validation error

  • context (str) – A description of the context where the error occurred

  • pageNo (int) – The page number this error is associated to or 0

  • objectNo (int) – The number of the PDF object this error is associated to

alias of Callable[[str | None, str, ErrorCategory, str, int, int], None]

class pdftools_sdk.pdf_a.validation.validator.Validator[source]

Bases: _NativeObject

The class to validate the standard conformance of documents

__init__()[source]
validate(document: Document, options: ValidationOptions | None = None) ValidationResult[source]

Validate the standards conformance of a PDF document.

Parameters:
Returns:

The result of the validation

Return type:

pdftools_sdk.pdf_a.validation.validation_result.ValidationResult

Raises:
analyze(document: Document, options: AnalysisOptions | None = None) AnalysisResult[source]

Analyze a PDF document in preparation for its conversion to PDF/A.

This method validates the document’s standards conformance like pdftools_sdk.pdf_a.validation.validator.Validator.validate() . In addition to that, certain additional checks can be performed. However, the main difference is that the analysis result can be used in pdftools_sdk.pdf_a.conversion.converter.Converter.convert() to convert the PDF document to PDF/A.

Parameters:
Returns:

The result of the analysis

Return type:

pdftools_sdk.pdf_a.validation.analysis_result.AnalysisResult

Raises:
add_error_handler(handler: Callable[[str | None, str, ErrorCategory, str, int, int], None]) None[source]

Add handler for the ErrorFunc() event.

Parameters:

handler – Event handler. If a handler is added that is already registered, it is ignored.

remove_error_handler(handler: Callable[[str | None, str, ErrorCategory, str, int, int], None]) None[source]

Remove registered handler of the ErrorFunc() event.

Parameters:

handler – Event handler that shall be removed. If a handler is not registered, it is ignored.