pdftools_sdk.pdf_a.validation.validator
Module Attributes
Report a validation issue found in |
Classes
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()
orpdftools_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
- validate(document: Document, options: ValidationOptions | None = None) ValidationResult [source]
Validate the standards conformance of a PDF document.
- Parameters:
document (pdftools_sdk.pdf.document.Document) – The document to check the quality of
options (Optional[pdftools_sdk.pdf_a.validation.validation_options.ValidationOptions]) – The options or None for default validation options
- Returns:
The result of the validation
- Return type:
pdftools_sdk.pdf_a.validation.validation_result.ValidationResult
- Raises:
pdftools_sdk.license_error.LicenseError – The license check has failed.
pdftools_sdk.processing_error.ProcessingError – The processing has failed.
- 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 inpdftools_sdk.pdf_a.conversion.converter.Converter.convert()
to convert the PDF document to PDF/A.- Parameters:
document (pdftools_sdk.pdf.document.Document) – The document to analyze
options (Optional[pdftools_sdk.pdf_a.validation.analysis_options.AnalysisOptions]) – The options or None for default analysis options
- Returns:
The result of the analysis
- Return type:
pdftools_sdk.pdf_a.validation.analysis_result.AnalysisResult
- Raises:
pdftools_sdk.license_error.LicenseError – The license check has failed.
ValueError – The conformance of the options argument is not PDF/A.
- 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.