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 PreflightConfiguration
private Integer
private javax.activation.DataSource
The datasource to load the document from.private PreflightDocument
The PDFbox object representation of the PDF source.private long
private final Map<COSBase,
FontContainer<?>> Contains the list of font name embedded in the PDF document.private boolean
private ICCProfileWrapper
This wrapper contains the ICCProfile used by the PDF file.private XMPMetadata
MetaData of the current pdf file.private final Set<COSObjectable>
private PreflightPath
private XrefTrailerResolver
Contains all Xref/trailer objects and resolves them into single object using startxref reference. -
Constructor Summary
ConstructorsConstructorDescriptionPreflightContext
(javax.activation.DataSource dataSource) Create the DocumentHandler using the DataSource which represent the PDF file to check.PreflightContext
(javax.activation.DataSource dataSource, PreflightConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFontContainer
(COSBase cBase, FontContainer<?> fc) Add a FontContainer to allow TextObject validation.void
Add the argument to the set of processed elements,void
Add the given error the PreflightDocumentvoid
Add the given errors the PreflightDocumentvoid
close()
Close all opened resourcesReturns the current page number or null if none is known.long
getFontContainer
(COSBase cBase) Return the FontContainer identified by the COSBase.javax.activation.DataSource
boolean
boolean
boolean
Tell if the argument is in the set of processed elements.void
setConfig
(PreflightConfiguration config) void
setCurrentPageNumber
(Integer currentPageNumber) Sets or resets the current page number.void
setDocument
(PreflightDocument document) Initialize the PDFBox object which present the PDF File.void
setFileLen
(long fileLen) void
setIccProfileAlreadySearched
(boolean iccProfileAlreadySearched) void
setIccProfileWrapper
(ICCProfileWrapper iccProfileWrapper) void
setMetadata
(XMPMetadata metadata) void
setValidationPath
(PreflightPath validationPath) void
setXrefTrailerResolver
(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
private javax.activation.DataSource dataSourceThe 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
public PreflightContext(javax.activation.DataSource dataSource) Create the DocumentHandler using the DataSource which represent the PDF file to check.- Parameters:
dataSource
-
-
PreflightContext
public PreflightContext(javax.activation.DataSource dataSource, PreflightConfiguration configuration)
-
-
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
public javax.activation.DataSource 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 thefontContainers
map, 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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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.
-