Class PreflightDocument

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class PreflightDocument
    extends org.apache.pdfbox.pdmodel.PDDocument
    • Constructor Summary

      Constructors 
      Constructor Description
      PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc, Format format)
      Create a preflight document based on the COSDocument and load the default configuration for the given format.
      PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc, Format format, PreflightConfiguration config)
      Deprecated.
      use the 4 parameter constructor and pass the source.
      PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc, Format format, PreflightConfiguration config, org.apache.pdfbox.io.RandomAccessRead source)
      Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addValidationError​(ValidationResult.ValidationError error)
      Add a validation error.
      void addValidationErrors​(java.util.List<ValidationResult.ValidationError> errorList)
      Add a list of validation errors.
      PreflightContext getContext()
      Returns the associated preflight context.
      Format getSpecification()
      Returns the format which is used to validate the pdf document.
      java.util.List<ValidationResult.ValidationError> getValidationErrors()
      Returns an unmodifiable list of all validation errors.
      void setContext​(PreflightContext context)
      Set the preflight context for this document.
      ValidationResult validate()
      Check that PDDocument is a valid file according to the format given during the object creation.
      • Methods inherited from class org.apache.pdfbox.pdmodel.PDDocument

        addPage, addSignature, addSignature, addSignature, addSignature, close, getCurrentAccessPermission, getDocument, getDocumentCatalog, getDocumentId, getDocumentInformation, getEncryption, getLastSignatureDictionary, getNumberOfPages, getPage, getPages, getResourceCache, getSignatureDictionaries, getSignatureFields, getVersion, importPage, isAllSecurityToBeRemoved, isEncrypted, protect, registerTrueTypeFontForClosing, removePage, removePage, save, save, save, save, save, save, saveIncremental, saveIncremental, saveIncrementalForExternalSigning, setAllSecurityToBeRemoved, setDocumentId, setDocumentInformation, setEncryptionDictionary, setResourceCache, setVersion
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PreflightDocument

        public PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc,
                                 Format format)
        Create a preflight document based on the COSDocument and load the default configuration for the given format.
        Parameters:
        doc - the underlying COSDocument
        format - the format used for validation
      • PreflightDocument

        @Deprecated
        public PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc,
                                 Format format,
                                 PreflightConfiguration config)
        Deprecated.
        use the 4 parameter constructor and pass the source.
        Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation. If the configuration is null, a default configuration will be loaded using the given format.
        Parameters:
        doc - the underlying COSDocument
        format - the format used for validation
        config - the configuration used for validation
      • PreflightDocument

        public PreflightDocument​(org.apache.pdfbox.cos.COSDocument doc,
                                 Format format,
                                 PreflightConfiguration config,
                                 org.apache.pdfbox.io.RandomAccessRead source)
        Create a preflight document based on the COSDocument that will use the given configuration bean to process the validation. If the configuration is null, a default configuration will be loaded using the given format.
        Parameters:
        doc - the underlying COSDocument
        format - the format used for validation
        config - the configuration used for validation
        source - input representing the pdf
    • Method Detail

      • getValidationErrors

        public java.util.List<ValidationResult.ValidationError> getValidationErrors()
        Returns an unmodifiable list of all validation errors.
        Returns:
        an unmodifiable list of all validation errors
      • addValidationError

        public void addValidationError​(ValidationResult.ValidationError error)
        Add a validation error.
        Parameters:
        error - the validation error to be added
      • addValidationErrors

        public void addValidationErrors​(java.util.List<ValidationResult.ValidationError> errorList)
        Add a list of validation errors.
        Parameters:
        errorList - the list of validation errors
      • getContext

        public PreflightContext getContext()
        Returns the associated preflight context. It is created after parsing the pdf.
        Returns:
        the associated preflight context
      • setContext

        public void setContext​(PreflightContext context)
        Set the preflight context for this document.
        Parameters:
        context - the associated preflight context
      • getSpecification

        public Format getSpecification()
        Returns the format which is used to validate the pdf document.
        Returns:
        the format used for validation