Top Fields Constructors Methods
org.apache.pdfbox.preflight

public Class PreflightDocument

extends PDDocument
Class Inheritance
Imports
java.util.Collection, .Collections, .List, org.apache.pdfbox.cos.COSDocument, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.preflight.ValidationResult.ValidationError, org.apache.pdfbox.preflight.exception.ValidationException, org.apache.pdfbox.preflight.utils.ContextHelper

Field Summary

Modifier and TypeField and Description
private final PreflightConfiguration
private PreflightContext
private final ValidationResult
private final Format

Constructor Summary

AccessConstructor and Description
public
PreflightDocument(COSDocument
the underlying COSDocument
doc
,
Format
the format used for validation
format
)

Create a preflight document based on the COSDocument and load the default configuration for the given format.

public
PreflightDocument(COSDocument
the underlying COSDocument
doc
,
Format
the format used for validation
format
,
PreflightConfiguration
the configuration used for validation
config
)

Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation.

Method Summary

Modifier and TypeMethod and Description
public void
addValidationError(ValidationResult.ValidationError
the validation error to be added
error
)

Add a validation error.

public void
addValidationErrors(List<ValidationResult.ValidationError>
the list of validation errors
errorList
)

Add a list of validation errors.

public PreflightContext

Returns:

the associated preflight context
getContext
()

Returns the associated preflight context.

public Format

Returns:

the format used for validation
getSpecification
()

Returns the format which is used to validate the pdf document.

public List<ValidationResult.ValidationError>

Returns:

an unmodifiable list of all validation errors
getValidationErrors
()

Returns an unmodifiable list of all validation errors.

public void
setContext(PreflightContext
the associated preflight context
context
)

Set the preflight context for this document.

public ValidationResult

Returns:

the validation result
validate
()

Check that PDDocument is a valid file according to the format given during the object creation.

Inherited from org.apache.pdfbox.pdmodel.PDDocument:
addPageaddSignatureaddSignatureaddSignatureaddSignatureclosegetCurrentAccessPermissiongetDocumentgetDocumentCataloggetDocumentIdgetDocumentInformationgetEncryptiongetLastSignatureDictionarygetNumberOfPagesgetPagegetPagesgetResourceCachegetSignatureDictionariesgetSignatureFieldsgetVersionimportPageisAllSecurityToBeRemovedisEncryptedprotectregisterTrueTypeFontForClosingremovePageremovePagesavesavesavesavesavesavesaveIncrementalsaveIncrementalsaveIncrementalForExternalSigningsetAllSecurityToBeRemovedsetDocumentIdsetDocumentInformationsetEncryptionDictionarysetResourceCachesetVersion

Field Detail

configback to summary
private final PreflightConfiguration config
contextback to summary
private PreflightContext context
resultback to summary
private final ValidationResult result
specificationback to summary
private final Format specification

Constructor Detail

PreflightDocumentback to summary
public PreflightDocument(COSDocument doc, Format format)

Create a preflight document based on the COSDocument and load the default configuration for the given format.

Parameters
doc:COSDocument

the underlying COSDocument

format:Format

the format used for validation

PreflightDocumentback to summary
public PreflightDocument(COSDocument doc, Format format, PreflightConfiguration config)

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 load using the given format.

Parameters
doc:COSDocument

the underlying COSDocument

format:Format

the format used for validation

config:PreflightConfiguration

the configuration used for validation

Method Detail

addValidationErrorback to summary
public void addValidationError(ValidationResult.ValidationError error)

Add a validation error.

Parameters
error:ValidationResult.ValidationError

the validation error to be added

addValidationErrorsback to summary
public void addValidationErrors(List<ValidationResult.ValidationError> errorList)

Add a list of validation errors.

Parameters
errorList:List<ValidationResult.ValidationError>

the list of validation errors

getContextback to summary
public PreflightContext getContext()

Returns the associated preflight context. It is created after parsing the pdf.

Returns:PreflightContext

the associated preflight context

getSpecificationback to summary
public Format getSpecification()

Returns the format which is used to validate the pdf document.

Returns:Format

the format used for validation

getValidationErrorsback to summary
public List<ValidationResult.ValidationError> getValidationErrors()

Returns an unmodifiable list of all validation errors.

Returns:List<ValidationResult.ValidationError>

an unmodifiable list of all validation errors

setContextback to summary
public void setContext(PreflightContext context)

Set the preflight context for this document.

Parameters
context:PreflightContext

the associated preflight context

validateback to summary
public ValidationResult validate() throws ValidationException

Check that PDDocument is a valid file according to the format given during the object creation.

Returns:ValidationResult

the validation result