Package org.apache.pdfbox.preflight
Class PreflightDocument
java.lang.Object
org.apache.pdfbox.pdmodel.PDDocument
org.apache.pdfbox.preflight.PreflightDocument
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PreflightConfigurationprivate PreflightContextprivate final ValidationResultprivate final Format -
Constructor Summary
ConstructorsConstructorDescriptionPreflightDocument(COSDocument doc, Format format) Create a preflight document based on the COSDocument and load the default configuration for the given format.PreflightDocument(COSDocument doc, Format format, PreflightConfiguration config) Deprecated.use the 4 parameter constructor and pass the source.PreflightDocument(COSDocument doc, Format format, PreflightConfiguration config, RandomAccessRead source) Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a validation error.voidaddValidationErrors(List<ValidationResult.ValidationError> errorList) Add a list of validation errors.Returns the associated preflight context.Returns the format which is used to validate the pdf document.Returns an unmodifiable list of all validation errors.voidsetContext(PreflightContext context) Set the preflight context for this document.validate()Check that PDDocument is a valid file according to the format given during the object creation.Methods inherited from class org.apache.pdfbox.pdmodel.PDDocument
addPage, addSignature, addSignature, addSignature, addSignature, close, getCurrentAccessPermission, getDocument, getDocumentCatalog, getDocumentId, getDocumentInformation, getEncryption, getLastSignatureDictionary, getNumberOfPages, getPage, getPages, getResourceCache, getSignatureDictionaries, getSignatureFields, getVersion, importPage, isAllSecurityToBeRemoved, isEncrypted, protect, registerTrueTypeFontForClosing, removePage, removePage, save, save, save, save, save, save, saveIncremental, saveIncremental, saveIncrementalForExternalSigning, setAllSecurityToBeRemoved, setDocumentId, setDocumentInformation, setEncryptionDictionary, setResourceCache, setVersion
-
Field Details
-
result
-
config
-
context
-
specification
-
-
Constructor Details
-
PreflightDocument
Create a preflight document based on the COSDocument and load the default configuration for the given format.- Parameters:
doc- the underlying COSDocumentformat- the format used for validation
-
PreflightDocument
Deprecated.use the 4 parameter constructor and pass the source.Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation. If the configuration is null, a default configuration will be loaded using the given format.- Parameters:
doc- the underlying COSDocumentformat- the format used for validationconfig- the configuration used for validation
-
PreflightDocument
public PreflightDocument(COSDocument doc, Format format, PreflightConfiguration config, RandomAccessRead source) Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation. If the configuration is null, a default configuration will be loaded using the given format.- Parameters:
doc- the underlying COSDocumentformat- the format used for validationconfig- the configuration used for validationsource- input representing the pdf
-
-
Method Details
-
getValidationErrors
Returns an unmodifiable list of all validation errors.- Returns:
- an unmodifiable list of all validation errors
-
addValidationError
Add a validation error.- Parameters:
error- the validation error to be added
-
addValidationErrors
Add a list of validation errors.- Parameters:
errorList- the list of validation errors
-
getContext
Returns the associated preflight context. It is created after parsing the pdf.- Returns:
- the associated preflight context
-
setContext
Set the preflight context for this document.- Parameters:
context- the associated preflight context
-
validate
Check that PDDocument is a valid file according to the format given during the object creation.- Returns:
- the validation result
- Throws:
ValidationException
-
getSpecification
Returns the format which is used to validate the pdf document.- Returns:
- the format used for validation
-