Package org.apache.pdfbox.preflight
Class PreflightContext
java.lang.Object
org.apache.pdfbox.preflight.PreflightContext
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PreflightConfigurationprivate Integerprivate DataSourceThe datasource to load the document from.private PreflightDocumentThe PDFbox object representation of the PDF source.private longprivate final Map<COSBase,FontContainer<?>> Contains the list of font name embedded in the PDF document.private booleanprivate ICCProfileWrapperThis wrapper contains the ICCProfile used by the PDF file.private XMPMetadataMetaData of the current pdf file.private final Set<COSObjectable>private PreflightPathprivate XrefTrailerResolverContains all Xref/trailer objects and resolves them into single object using startxref reference. -
Constructor Summary
ConstructorsConstructorDescriptionPreflightContext(DataSource dataSource) Create the DocumentHandler using the DataSource which represent the PDF file to check.PreflightContext(DataSource dataSource, PreflightConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFontContainer(COSBase cBase, FontContainer<?> fc) Add a FontContainer to allow TextObject validation.voidAdd the argument to the set of processed elements,voidAdd the given error the PreflightDocumentvoidAdd the given errors the PreflightDocumentvoidclose()Close all opened resourcesReturns the current page number or null if none is known.longgetFontContainer(COSBase cBase) Return the FontContainer identified by the COSBase.booleanbooleanbooleanTell if the argument is in the set of processed elements.voidsetConfig(PreflightConfiguration config) voidsetCurrentPageNumber(Integer currentPageNumber) Sets or resets the current page number.voidsetDocument(PreflightDocument document) Initialize the PDFBox object which present the PDF File.voidsetFileLen(long fileLen) voidsetIccProfileAlreadySearched(boolean iccProfileAlreadySearched) voidsetIccProfileWrapper(ICCProfileWrapper iccProfileWrapper) voidsetMetadata(XMPMetadata metadata) voidsetValidationPath(PreflightPath validationPath) voidsetXrefTrailerResolver(XrefTrailerResolver xrefTrailerResolver)
-
Field Details
-
fontContainers
Contains the list of font name embedded in the PDF document. -
document
The PDFbox object representation of the PDF source. -
dataSource
The datasource to load the document from. Needed by StreamValidationProcess. -
xrefTrailerResolver
Contains all Xref/trailer objects and resolves them into single object using startxref reference. -
iccProfileWrapper
This wrapper contains the ICCProfile used by the PDF file. -
iccProfileAlreadySearched
private boolean iccProfileAlreadySearched -
metadata
MetaData of the current pdf file. -
config
-
validationPath
-
processedSet
-
currentPageNumber
-
fileLen
private long fileLen
-
-
Constructor Details
-
PreflightContext
Create the DocumentHandler using the DataSource which represent the PDF file to check.- Parameters:
dataSource-
-
PreflightContext
-
-
Method Details
-
getMetadata
- Returns:
- the metadata
-
setMetadata
- Parameters:
metadata- the metadata to set
-
getDocument
- Returns:
- the PDFBox object representation of the document
-
getXrefTrailerResolver
-
setXrefTrailerResolver
-
setDocument
Initialize the PDFBox object which present the PDF File.- Parameters:
document-
-
getSource
- Returns:
- The datasource of the pdf document
-
isComplete
public boolean isComplete() -
addFontContainer
Add a FontContainer to allow TextObject validation.- Parameters:
cBase- the COSBase for the font container.fc- the font container.
-
getFontContainer
Return the FontContainer identified by the COSBase. If the given object is missing from thefontContainersmap, the null value is returned.- Parameters:
cBase- the COSBase for the font container- Returns:
- the font container.
-
getIccProfileWrapper
- Returns:
- the iccProfileWrapper
-
setIccProfileWrapper
- Parameters:
iccProfileWrapper- the iccProfileWrapper to set
-
getConfig
-
setConfig
-
close
public void close()Close all opened resources- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
addValidationError
Add the given error the PreflightDocument- Parameters:
error-
-
addValidationErrors
Add the given errors the PreflightDocument- Parameters:
errors- the list of validation errors.
-
getValidationPath
-
setValidationPath
-
isIccProfileAlreadySearched
public boolean isIccProfileAlreadySearched() -
setIccProfileAlreadySearched
public void setIccProfileAlreadySearched(boolean iccProfileAlreadySearched) -
setCurrentPageNumber
Sets or resets the current page number.- Parameters:
currentPageNumber- zero based page number or null if none is known.
-
getCurrentPageNumber
Returns the current page number or null if none is known. -
setFileLen
public void setFileLen(long fileLen) -
getFileLen
public long getFileLen() -
addToProcessedSet
Add the argument to the set of processed elements,- Parameters:
cos-
-
isInProcessedSet
Tell if the argument is in the set of processed elements.- Parameters:
cos-- Returns:
- true if in the set, false if not.
-