Interface OutputItem


public interface OutputItem

An OutputItem contains a partial result of a conversion and meta information.

This meta information includes the item number, the total number or items and the file extension.

A Callback can be set to be called after a partial result is completed.

OutputItems are available when using PDFreactor.convert(Configuration, OutputStreamProvider).

For each partial result an OutputItem is created.

It contains a partial result of the conversion, such as a single image of a multiple images Configuration.OutputFormat.

The OutputItem can be accessed via the provided OutputStreamProvider.provide(OutputItem) function.

For more information please have a look at the PDFreactor manual.

  • Method Details

    • getOutputStream

      OutputStream getOutputStream()

      Returns the OutputStream that belongs to the OutputItem.

    • getIndex

      int getIndex()

      Returns the index of the item. Starts at 0 and is incremented for each subsequent item, independent of the getItemNumber(), getGroup(), or getItemCount(), meaning each item will have a unique index.

      Returns:
      The index of the partial result.
    • getFileExtension

      String getFileExtension()

      Returns the file extension according to the Configuration.OutputFormat.

      It is set automatically by PDFreactor during conversion.

      Returns:
      The file extension of the the partial result.
    • getPaddedItemNumber

      String getPaddedItemNumber(int padding)

      Same as getItemNumber(), but the result is padded. The padding parameter specifies how many digits should be padded with '0'.

      For example, this method returns '001' for the first item if padding is set to 2.

      Parameters:
      padding - Number of digits to be padded with '0'.
      Returns:
      The item number of the the partial result.
    • getPaddedItemNumber

      String getPaddedItemNumber()

      Same as getItemNumber(), but the result is automatically padded according to the total number of items.

      Returns:
      The item number of the the partial result.
    • getItemNumber

      int getItemNumber()

      Returns the item number of the OutputItem. For multi-image conversions, the item number is equivalent to the page number.

      The item number in combination with the getGroup() represent a unique identifier for this item.

      Returns:
      The item number of the the partial result.
    • getItemCount

      int getItemCount()

      Returns the total number of items of the conversion result within a specific group.

      Returns:
      The total number of items of the conversion result.
      See Also:
    • setKeepOpen

      void setKeepOpen(boolean value)

      Sets whether the OutputStream to be closed after the partial result has been written.

      Default value is 'false'

      Parameters:
      value - Whether the provided OutputStream should be closed after the partial result has been written.
    • isKeepOpen

      boolean isKeepOpen()

      Returns whether the OutputStream is closed after the partial result has been written.

      Returns:
      Whether the OutputStream is closed after the partial result has been written.
    • setCallback

      void setCallback(Callback callback)

      Sets a Callback.call(OutputItem) function which is called by PDFreactor after a partial result has been finished.

      Parameters:
      callback - The Callback function which is called after the partial result has been written.
    • getGroup

      OutputItemGroup getGroup()

      Returns the group to which this item belongs.

      The group in combination with the getItemNumber() represent a unique identifier for this item.

      Returns:
      The OutputItemGroup.