org.apache.pdfbox.preflight

## Class PreflightContext

- java.lang.Object
- - org.apache.pdfbox.preflight.PreflightContext

All Implemented Interfaces:
  Closeable, AutoCloseable

    public class PreflightContext
    extends Object
    implements Closeable

### Constructor Summary

Constructors
Constructor and Description
`PreflightContext()` Create the DocumentHandler using the DataSource which represent the PDF file to check.
`PreflightContext(PreflightConfiguration configuration)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addFontContainer(org.apache.pdfbox.cos.COSBase cBase, FontContainer<?> fc)` Add a FontContainer to allow TextObject validation.
`void` `addToProcessedSet(org.apache.pdfbox.pdmodel.common.COSObjectable cos)` Add the argument to the set of processed elements,
`void` `addValidationError(ValidationResult.ValidationError error)` Add the given error the PreflightDocument
`void` `addValidationErrors(List<ValidationResult.ValidationError> errors)` Add the given errors the PreflightDocument
`void` `close()` Close all opened resources
`PreflightConfiguration` `getConfig()`
`Integer` `getCurrentPageNumber()` Returns the current page number or null if none is known.
`PreflightDocument` `getDocument()`
`long` `getFileLen()`
`FontContainer<?>` `getFontContainer(org.apache.pdfbox.cos.COSBase cBase)` Return the FontContainer identified by the COSBase.
`ICCProfileWrapper` `getIccProfileWrapper()`
`org.apache.xmpbox.XMPMetadata` `getMetadata()`
`PreflightPath` `getValidationPath()`
`org.apache.pdfbox.pdfparser.XrefTrailerResolver` `getXrefTrailerResolver()`
`boolean` `isIccProfileAlreadySearched()`
`boolean` `isInProcessedSet(org.apache.pdfbox.pdmodel.common.COSObjectable cos)` 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(org.apache.xmpbox.XMPMetadata metadata)`
`void` `setValidationPath(PreflightPath validationPath)`
`void` `setXrefTrailerResolver(org.apache.pdfbox.pdfparser.XrefTrailerResolver xrefTrailerResolver)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PreflightContext

    public PreflightContext()

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

#### PreflightContext

    public PreflightContext(PreflightConfiguration configuration)

### Method Detail

#### getMetadata

    public org.apache.xmpbox.XMPMetadata getMetadata()

Returns:
  the metadata

#### setMetadata

    public void setMetadata(org.apache.xmpbox.XMPMetadata metadata)

Parameters:
  `metadata` - the metadata to set

#### getDocument

    public PreflightDocument getDocument()

Returns:
  the PDFBox object representation of the document

#### getXrefTrailerResolver

    public org.apache.pdfbox.pdfparser.XrefTrailerResolver getXrefTrailerResolver()

#### setXrefTrailerResolver

    public void setXrefTrailerResolver(org.apache.pdfbox.pdfparser.XrefTrailerResolver xrefTrailerResolver)

#### setDocument

    public void setDocument(PreflightDocument document)

Initialize the PDFBox object which present the PDF File.

Parameters:
  `document` -

#### addFontContainer

    public void addFontContainer(org.apache.pdfbox.cos.COSBase cBase,
                                 FontContainer<?> fc)

Add a FontContainer to allow TextObject validation.

Parameters:
  `cBase` - the COSBase for the font container.
  `fc` - the font container.

#### getFontContainer

    public FontContainer<?> getFontContainer(org.apache.pdfbox.cos.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` - the COSBase for the font container
Returns:
  the font container.

#### getIccProfileWrapper

    public ICCProfileWrapper getIccProfileWrapper()

Returns:
  the iccProfileWrapper

#### setIccProfileWrapper

    public void setIccProfileWrapper(ICCProfileWrapper iccProfileWrapper)

Parameters:
  `iccProfileWrapper` - the iccProfileWrapper to set

#### getConfig

    public PreflightConfiguration getConfig()

#### setConfig

    public void setConfig(PreflightConfiguration config)

#### close

    public void close()

Close all opened resources

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`

#### addValidationError

    public void addValidationError(ValidationResult.ValidationError error)

Add the given error the PreflightDocument

Parameters:
  `error` -

#### addValidationErrors

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

Add the given errors the PreflightDocument

Parameters:
  `errors` - the list of validation errors.

#### getValidationPath

    public PreflightPath getValidationPath()

#### setValidationPath

    public void setValidationPath(PreflightPath validationPath)

#### isIccProfileAlreadySearched

    public boolean isIccProfileAlreadySearched()

#### setIccProfileAlreadySearched

    public void setIccProfileAlreadySearched(boolean iccProfileAlreadySearched)

#### setCurrentPageNumber

    public void setCurrentPageNumber(Integer currentPageNumber)

Sets or resets the current page number.

Parameters:
  `currentPageNumber` - zero based page number or null if none is known.

#### getCurrentPageNumber

    public Integer getCurrentPageNumber()

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

#### setFileLen

    public void setFileLen(long fileLen)

#### getFileLen

    public long getFileLen()

#### addToProcessedSet

    public void addToProcessedSet(org.apache.pdfbox.pdmodel.common.COSObjectable cos)

Add the argument to the set of processed elements,

Parameters:
  `cos` -

#### isInProcessedSet

    public boolean isInProcessedSet(org.apache.pdfbox.pdmodel.common.COSObjectable cos)

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

Parameters:
  `cos` -
Returns:
  true if in the set, false if not.