Class PdfArlingtonValidator

java.lang.Object
org.jpedal.arlington.validate.PdfArlingtonValidator

public final class PdfArlingtonValidator extends Object
Validates a PDF file against the Arlington Model.
See Also:
  • Constructor Details

    • PdfArlingtonValidator

      public PdfArlingtonValidator(Map<String,org.jpedal.arlington.model.ArlingtonObject> model, org.jpedal.io.writer.PdfFile info, org.jpedal.io.writer.PdfBuffer buffer, float pdfVersion)
      Create a new instance of the validator.
      Parameters:
      model - the Arlington Model to validate against
      info - the currently loaded PDF
      buffer - the buffer object for the currently loaded PDF
      pdfVersion - the currently loaded PDF version
  • Method Details

    • getIssues

      public List<ValidationIssue> getIssues()
      Returns all issues collected so far..
      Returns:
      all issues collected so far
    • validateObject

      public void validateObject(org.jpedal.io.writer.PdfObjectInt obj, String arlingtonObjectName, String path) throws IOException
      Validate an arbitrary resolved object against a TSV definition.
      Parameters:
      obj - the resolved object to check
      arlingtonObjectName - the Arlington TSV name to validate against
      path - a human readable path label
      Throws:
      IOException - if the underlying PDF cannot be read
    • main

      public static void main(String[] args) throws IOException
      Entry point that validates one or more PDF files against the Arlington Model.

      Usage:

      
       java org.jpedal.arlington.validate.PdfArlingtonValidator --tsv <path-to-arlington-tsv-dir> [--level LEVEL] file1.pdf [file2.pdf ...]
       
      Throws:
      IOException
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(File pdfFile, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file on disk
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(File pdfFile, byte[] password, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file on disk
      password - the password for the file, or null if it does not have one
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file as a byte array
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, byte[] password, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file as a byte array
      password - the password for the file, or null if it does not have one
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file on disk
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all
    • validateFile

      public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, byte[] password, Map<String,org.jpedal.arlington.model.ArlingtonObject> model) throws IOException
      Validate a single PDF file against the Arlington model.
      Parameters:
      pdfFile - the PDF file from an InputStream
      password - the password for the file, or null if it does not have one
      model - the loaded Arlington model
      Returns:
      the validation result (PDF version detected plus all issues found)
      Throws:
      IOException - if the PDF cannot be opened/parsed at all