Class RecognitionResultHolder

java.lang.Object
com.itextpdf.pdf2data.RecognitionResultHolder

public class RecognitionResultHolder extends Object
Recognition result holder with methods to operate with the results.
  • Constructor Details

    • RecognitionResultHolder

      public RecognitionResultHolder (RecognitionResult result)
      Creates an instance with specified result.
      Parameters:
      result - recognition result to be used in holder
  • Method Details

    • readFromJson

      public static RecognitionResultHolder readFromJson (InputStream is)
      Reads result from input stream containing the recognition result in JSON format.
      Parameters:
      is - the InputStream to read from
      Returns:
      an instance of RecognitionResultHolder based on the read result
      Throws:
      InvalidResultException - if the read result has invalid schema version
    • getResult

      public RecognitionResult getResult()
      Retrieve result object.
      Returns:
      RecognitionResult instance
    • writeToJson

      public void writeToJson (File outputJson) throws IOException
      Writes holded result into the specified file as JSON.
      Parameters:
      outputJson - the File to write into
      Throws:
      IOException - if any I/O exception occurs
    • writeToJson

      public void writeToJson (File outputJson, SerializationProperties properties) throws IOException
      Writes holded result into the specified file as JSON.
      Parameters:
      outputJson - the File to write into
      properties - serialization properties
      Throws:
      IOException - if any I/O exception occurs
    • writeToJson

      public void writeToJson (OutputStream jsonOutputStream)
      Writes holded result into the specified output stream as JSON.
      Parameters:
      jsonOutputStream - the OutputStream to write into
    • writeToJson

      public void writeToJson (OutputStream jsonOutputStream, SerializationProperties properties)
      Writes holded result into the specified output stream as JSON.
      Parameters:
      jsonOutputStream - the OutputStream to write into
      properties - serialization properties
    • writeToXml

      public void writeToXml (File outputXml) throws IOException
      Saves recognition results to provided xml file.
      Parameters:
      outputXml - xml file
      Throws:
      IOException - if any I/O exception occurs
    • writeToXml

      public void writeToXml (File outputXml, SerializationProperties properties) throws IOException
      Saves recognition results to provided xml file.
      Parameters:
      outputXml - output stream
      properties - a SerializationProperties instance
      Throws:
      IOException - if any I/O exception occurs
    • writeToXml

      public void writeToXml (OutputStream xmlOutputStream) throws IOException
      Saves recognition results to output stream in xml form.
      Parameters:
      xmlOutputStream - output stream
      Throws:
      IOException - if any I/O exception occurs
    • writeToXml

      public void writeToXml (OutputStream xmlOutputStream, SerializationProperties properties) throws IOException
      Saves recognition results to output stream in xml form.
      Parameters:
      xmlOutputStream - output stream
      properties - a SerializationProperties instance
      Throws:
      IOException - if any I/O exception occurs