Package org.apache.pdfbox.preflight
Class PreflightDocument
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.PDDocument
-
- org.apache.pdfbox.preflight.PreflightDocument
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class PreflightDocument extends PDDocument
-
-
Field Summary
Fields Modifier and Type Field Description private PreflightConfiguration
config
private PreflightContext
context
private ValidationResult
result
private Format
specification
-
Constructor Summary
Constructors Constructor Description PreflightDocument(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)
Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation.PreflightDocument(Format format)
Create an empty preflight document and load the default configuration for the given format.PreflightDocument(Format format, PreflightConfiguration cfg)
Create an empty preflight document that will use the given configuration bean to process the validation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValidationError(ValidationResult.ValidationError error)
PreflightContext
getContext()
ValidationResult
getResult()
Format
getSpecification()
private void
initConfiguration(Format format)
void
setContext(PreflightContext context)
void
setResult(ValidationResult result)
void
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, addSignatureField, close, getCurrentAccessPermission, getDocument, getDocumentCatalog, getDocumentId, getDocumentInformation, getEncryption, getLastSignatureDictionary, getNumberOfPages, getPage, getPages, getResourceCache, getSignatureDictionaries, getSignatureFields, getVersion, importPage, isAllSecurityToBeRemoved, isEncrypted, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, protect, registerTrueTypeFontForClosing, removePage, removePage, save, save, save, saveIncremental, saveIncremental, saveIncrementalForExternalSigning, setAllSecurityToBeRemoved, setDocumentId, setDocumentInformation, setEncryptionDictionary, setResourceCache, setVersion
-
-
-
-
Field Detail
-
result
private ValidationResult result
-
config
private PreflightConfiguration config
-
context
private PreflightContext context
-
specification
private final Format specification
-
-
Constructor Detail
-
PreflightDocument
public PreflightDocument(Format format) throws java.io.IOException
Create an empty preflight document and load the default configuration for the given format.- Parameters:
format
-- Throws:
java.io.IOException
-
PreflightDocument
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
-format
-
-
PreflightDocument
public PreflightDocument(Format format, PreflightConfiguration cfg) throws java.io.IOException
Create an empty preflight document 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:
format
-cfg
-- Throws:
java.io.IOException
-
PreflightDocument
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
-format
-config
-
-
-
Method Detail
-
initConfiguration
private void initConfiguration(Format format)
-
getResult
public ValidationResult getResult()
-
setResult
public void setResult(ValidationResult result)
-
addValidationError
public void addValidationError(ValidationResult.ValidationError error)
-
getContext
public PreflightContext getContext()
-
setContext
public void setContext(PreflightContext context)
-
validate
public void validate() throws ValidationException
Check that PDDocument is a valid file according to the format given during the object creation.- Throws:
ValidationException
-
getSpecification
public Format getSpecification()
-
-