org.apache.pdfbox.preflight.process

## Class TrailerValidationProcess

- java.lang.Object
- - org.apache.pdfbox.preflight.process.AbstractProcess
  - - org.apache.pdfbox.preflight.process.TrailerValidationProcess

All Implemented Interfaces:
  ValidationProcess

    public class TrailerValidationProcess
    extends AbstractProcess

### Constructor Summary

Constructors
Constructor and Description
`TrailerValidationProcess()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `checkLinearizedDictionnary(PreflightContext ctx, org.apache.pdfbox.cos.COSDictionary linearizedDict)` Check if mandatory keys of linearized dictionary are present.
`protected void` `checkMainTrailer(PreflightContext ctx, org.apache.pdfbox.cos.COSDictionary trailer)` check if all keys are authorized in a trailer dictionary and if the type is valid.
`protected void` `checkTrailersForLinearizedPDF14(PreflightContext ctx)` Extracts and compares first and last trailers for PDF version between 1.1 and 1.4.
`protected void` `checkTrailersForLinearizedPDF15(PreflightContext ctx)` Accesses and compares First and Last trailers for a PDF version higher than 1.4.
`protected boolean` `compareIds(org.apache.pdfbox.cos.COSDictionary first, org.apache.pdfbox.cos.COSDictionary last, org.apache.pdfbox.cos.COSDocument cosDocument)` Return true if the ID of the first dictionary is the same as the id of the last dictionary Return false otherwise.
`protected org.apache.pdfbox.cos.COSDictionary` `getLinearizedDictionary(org.apache.pdfbox.pdmodel.PDDocument document)` According to the PDF Reference, A linearized PDF contain a dictionary as first object (linearized dictionary) and only this one in the first section.
`void` `validate(PreflightContext ctx)`

### Methods inherited from class org.apache.pdfbox.preflight.process.AbstractProcess

`addFontError, addValidationError, addValidationErrors`

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

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

### Constructor Detail

#### TrailerValidationProcess

    public TrailerValidationProcess()

### Method Detail

#### validate

    public void validate(PreflightContext ctx)
                  throws ValidationException

Throws:
  `ValidationException`

#### checkTrailersForLinearizedPDF14

    protected void checkTrailersForLinearizedPDF14(PreflightContext ctx)

Extracts and compares first and last trailers for PDF version between 1.1 and 1.4.

Parameters:
  `ctx` - the preflight context.

#### checkTrailersForLinearizedPDF15

    protected void checkTrailersForLinearizedPDF15(PreflightContext ctx)

Accesses and compares First and Last trailers for a PDF version higher than 1.4.

Parameters:
  `ctx` - the preflight context.

#### compareIds

    protected boolean compareIds(org.apache.pdfbox.cos.COSDictionary first,
                                 org.apache.pdfbox.cos.COSDictionary last,
                                 org.apache.pdfbox.cos.COSDocument cosDocument)

Return true if the ID of the first dictionary is the same as the id of the last dictionary Return false otherwise.

Parameters:
  `first` - the first dictionary for comparison.
  `last` - the last dictionary for comparison.
  `cosDocument` - the document.
Returns:
  true if the IDs of the first and last dictionary are the same.

#### checkMainTrailer

    protected void checkMainTrailer(PreflightContext ctx,
                                    org.apache.pdfbox.cos.COSDictionary trailer)

check if all keys are authorized in a trailer dictionary and if the type is valid.

Parameters:
  `ctx` - the preflight context.
  `trailer` - the trailer dictionary.

#### getLinearizedDictionary

    protected org.apache.pdfbox.cos.COSDictionary getLinearizedDictionary(org.apache.pdfbox.pdmodel.PDDocument document)

According to the PDF Reference, A linearized PDF contain a dictionary as first object (linearized dictionary) and only this one in the first section.

Parameters:
  `document` - the document to validate.
Returns:
  the linearization dictionary or null.

#### checkLinearizedDictionnary

    protected void checkLinearizedDictionnary(PreflightContext ctx,
                                              org.apache.pdfbox.cos.COSDictionary linearizedDict)

Check if mandatory keys of linearized dictionary are present.

Parameters:
  `ctx` - the preflight context.
  `linearizedDict` - the linearization dictionary.