Class PdfA3Converter

java.lang.Object
org.jpedal.tools.pdfa.PdfA3Converter

public final class PdfA3Converter extends Object
Converts PDF files into valid PDF/A-3 files.
  • Constructor Details

  • Method Details

    • setMemoryCacheThreshold

      public void setMemoryCacheThreshold(int memoryCacheThreshold)
      Set the threshold at which temporary files created by the PDF/A-3 Converter which exceed this size will be written to the disk rather than stored in memory.

      Default: 58MB

      Parameters:
      memoryCacheThreshold - the threshold
      See Also:
    • getMemoryCacheThreshold

      public int getMemoryCacheThreshold()
      Returns the current threshold for which temporary files are written to disk rather than being stored in memory.
      Returns:
      the current threshold for which temporary files are written to disk rather than being stored in memory
      See Also:
    • isLinearizeDocument

      public boolean isLinearizeDocument()
      Check if output will be linearized for fast web view
      Returns:
      True is the file will be linearized, otherwise False
    • setLinearizeDocument

      public void setLinearizeDocument(boolean linearizeDocument)
      Set f the output of writeDocument should be linearized for fast web view.
      Parameters:
      linearizeDocument - True is output should be linearized, otherwise False
    • convert

      public PdfA3Converter.ConversionResult convert(File input, File output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output. The input file is assumed not to be password protected.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
      See Also:
    • convert

      public PdfA3Converter.ConversionResult convert(File input, byte[] password, File output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      password - the password to decrypt the input file, or null if it is not encrypted
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
    • convert

      public PdfA3Converter.ConversionResult convert(byte[] input, OutputStream output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output. The input file is assumed not to be password protected.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
      See Also:
    • convert

      public PdfA3Converter.ConversionResult convert(byte[] input, byte[] password, OutputStream output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      password - the password to decrypt the input file, or null if it is not encrypted
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
    • convert

      public PdfA3Converter.ConversionResult convert(InputStream input, OutputStream output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output. The input file is assumed not to be password protected.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
      See Also:
      API Note:
      PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
    • convert

      public PdfA3Converter.ConversionResult convert(InputStream input, byte[] password, OutputStream output) throws IOException
      Convert the given PDF file into a PDF/A-3 file, writing the result to output.

      If the file cannot be made compliant, no output file is written and the returned result's list of issues will be non-empty.

      Parameters:
      input - the PDF file to convert
      password - the password to decrypt the input file, or null if it is not encrypted
      output - the file to write the converted PDF/A-3 file to
      Returns:
      the result of the conversion
      Throws:
      IOException - if the input file is invalid or an I/O error occurs during conversion
      API Note:
      PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
    • main

      public static void main(String[] args)
      Command-line entry point for the PDF/A-3 converter.

      Accepts --level/-l, --output/-o and one or more --input/-i arguments (each optionally followed by --password/-p and a password value), as well as positional input paths. Each input may be a PDF file or a directory of PDF files; every resolved file is converted and written into the given output directory. Prints usage information and exits if the arguments are missing or invalid.

      Parameters:
      args - the command-line arguments