Top Fields Constructors Methods
org.apache.pdfbox.preflight

public Class PreflightContext

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, java.util.HashMap, .HashSet, .List, .Map, .Set, org.apache.pdfbox.cos.COSBase, org.apache.pdfbox.io.IOUtils, org.apache.pdfbox.pdfparser.XrefTrailerResolver, org.apache.pdfbox.pdmodel.common.COSObjectable, org.apache.pdfbox.preflight.ValidationResult.ValidationError, org.apache.pdfbox.preflight.font.container.FontContainer, org.apache.pdfbox.preflight.graphic.ICCProfileWrapper, org.apache.xmpbox.XMPMetadata

Field Summary

Modifier and TypeField and Description
private PreflightConfiguration
private Integer
private PreflightDocument
document

The PDFbox object representation of the PDF source.

private long
private final Map<COSBase, FontContainer<?>>
fontContainers

Contains the list of font name embedded in the PDF document.

private boolean
private ICCProfileWrapper
iccProfileWrapper

This wrapper contains the ICCProfile used by the PDF file.

private XMPMetadata
metadata

MetaData of the current pdf file.

private final Set<COSObjectable>
private PreflightPath
private XrefTrailerResolver
xrefTrailerResolver

Contains all Xref/trailer objects and resolves them into single object using startxref reference.

Constructor Summary

AccessConstructor and Description
public
PreflightContext()

Create the DocumentHandler using the DataSource which represent the PDF file to check.

public

Method Summary

Modifier and TypeMethod and Description
public void
addFontContainer(COSBase
the COSBase for the font container.
cBase
,
FontContainer<?>
the font container.
fc
)

Add a FontContainer to allow TextObject validation.

public void
addToProcessedSet(COSObjectable cos)

Add the argument to the set of processed elements,

public void
addValidationError(ValidationResult.ValidationError error)

Add the given error the PreflightDocument

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

Add the given errors the PreflightDocument

public void
close()

Implements java.io.Closeable.close.

Close all opened resources

public PreflightConfiguration
public Integer
getCurrentPageNumber()

Returns the current page number or null if none is known.

public PreflightDocument

Returns:

the PDFBox object representation of the document
getDocument
()

public long
public FontContainer<?>

Returns:

the font container.
getFontContainer
(COSBase
the COSBase for the font container
cBase
)

Return the FontContainer identified by the COSBase.

public ICCProfileWrapper

Returns:

the iccProfileWrapper
getIccProfileWrapper
()

public XMPMetadata

Returns:

the metadata
getMetadata
()

public PreflightPath
public XrefTrailerResolver
public boolean
public boolean

Returns:

true if in the set, false if not.
isInProcessedSet
(COSObjectable cos)

Tell if the argument is in the set of processed elements.

public void
public void
setCurrentPageNumber(Integer
zero based page number or null if none is known.
currentPageNumber
)

Sets or resets the current page number.

public void
setDocument(PreflightDocument document)

Initialize the PDFBox object which present the PDF File.

public void
setFileLen(long fileLen)

public void
setIccProfileAlreadySearched(boolean iccProfileAlreadySearched)

public void
setIccProfileWrapper(ICCProfileWrapper
the iccProfileWrapper to set
iccProfileWrapper
)

public void
setMetadata(XMPMetadata
the metadata to set
metadata
)

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private PreflightConfiguration config
currentPageNumberback to summary
private Integer currentPageNumber
documentback to summary
private PreflightDocument document

The PDFbox object representation of the PDF source.

fileLenback to summary
private long fileLen
fontContainersback to summary
private final Map<COSBase, FontContainer<?>> fontContainers

Contains the list of font name embedded in the PDF document.

iccProfileAlreadySearchedback to summary
private boolean iccProfileAlreadySearched
iccProfileWrapperback to summary
private ICCProfileWrapper iccProfileWrapper

This wrapper contains the ICCProfile used by the PDF file.

metadataback to summary
private XMPMetadata metadata

MetaData of the current pdf file.

processedSetback to summary
private final Set<COSObjectable> processedSet
validationPathback to summary
private PreflightPath validationPath
xrefTrailerResolverback to summary
private XrefTrailerResolver xrefTrailerResolver

Contains all Xref/trailer objects and resolves them into single object using startxref reference.

Constructor Detail

PreflightContextback to summary
public PreflightContext()

Create the DocumentHandler using the DataSource which represent the PDF file to check.

PreflightContextback to summary
public PreflightContext(PreflightConfiguration configuration)

Method Detail

addFontContainerback to summary
public void addFontContainer(COSBase cBase, FontContainer<?> fc)

Add a FontContainer to allow TextObject validation.

Parameters
cBase:COSBase

the COSBase for the font container.

fc:FontContainer<?>

the font container.

addToProcessedSetback to summary
public void addToProcessedSet(COSObjectable cos)

Add the argument to the set of processed elements,

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

Add the given error the PreflightDocument

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

Add the given errors the PreflightDocument

Parameters
errors:List<ValidationResult.ValidationError>

the list of validation errors.

closeback to summary
public void close()

Implements java.io.Closeable.close.

Close all opened resources

Annotations
@Override
getConfigback to summary
public PreflightConfiguration getConfig()
getCurrentPageNumberback to summary
public Integer getCurrentPageNumber()

Returns the current page number or null if none is known.

getDocumentback to summary
public PreflightDocument getDocument()
Returns:PreflightDocument

the PDFBox object representation of the document

getFileLenback to summary
public long getFileLen()
getFontContainerback to summary
public FontContainer<?> getFontContainer(COSBase cBase)

Return the FontContainer identified by the COSBase. If the given object is missing from the fontContainers map, the null value is returned.

Parameters
cBase:COSBase

the COSBase for the font container

Returns:FontContainer<?>

the font container.

getIccProfileWrapperback to summary
public ICCProfileWrapper getIccProfileWrapper()
Returns:ICCProfileWrapper

the iccProfileWrapper

getMetadataback to summary
public XMPMetadata getMetadata()
Returns:XMPMetadata

the metadata

getValidationPathback to summary
public PreflightPath getValidationPath()
getXrefTrailerResolverback to summary
public XrefTrailerResolver getXrefTrailerResolver()
isIccProfileAlreadySearchedback to summary
public boolean isIccProfileAlreadySearched()
isInProcessedSetback to summary
public boolean isInProcessedSet(COSObjectable cos)

Tell if the argument is in the set of processed elements.

Returns:boolean

true if in the set, false if not.

setConfigback to summary
public void setConfig(PreflightConfiguration config)
setCurrentPageNumberback to summary
public void setCurrentPageNumber(Integer currentPageNumber)

Sets or resets the current page number.

Parameters
currentPageNumber:Integer

zero based page number or null if none is known.

setDocumentback to summary
public void setDocument(PreflightDocument document)

Initialize the PDFBox object which present the PDF File.

setFileLenback to summary
public void setFileLen(long fileLen)
setIccProfileAlreadySearchedback to summary
public void setIccProfileAlreadySearched(boolean iccProfileAlreadySearched)
setIccProfileWrapperback to summary
public void setIccProfileWrapper(ICCProfileWrapper iccProfileWrapper)
Parameters
iccProfileWrapper:ICCProfileWrapper

the iccProfileWrapper to set

setMetadataback to summary
public void setMetadata(XMPMetadata metadata)
Parameters
metadata:XMPMetadata

the metadata to set

setValidationPathback to summary
public void setValidationPath(PreflightPath validationPath)
setXrefTrailerResolverback to summary
public void setXrefTrailerResolver(XrefTrailerResolver xrefTrailerResolver)