Job.printToStreams method

printToStreams

void printToStreams(OutputStreamFactory factory) throws TFormerException

Referenced types: OutputStreamFactory

Print the current Job using the selected FormLayout and current JobData.

The output is available via multiple output streams created and closed by the provided OutputStreamFactory. With bitmap printer type (e.g. ImagePng) each page is printed on a separate stream.

Example

Supply a file stream for each requested output name:

  OutputStreamFactory factory = new OutputStreamFactory()
  {
    // Create a new stream
    // This function will be called for each requested stream before any output is generated
    // You may use this function to open files or to reserve memory
    public OutputStream createOutputStream(String name)
    throws IOException
    {
      // For demonstration purposes we create a file stream
      return new FileOutputStream (name);
    }
  };

Generate PNG output with this factory:

  // Generate a PNG image named StreamToFileExample.png
  // The provided OutputName is passed to CreateStream
  // If multiple pages are generated page numbers will get appended (e.g. StreamToFileExample_002.png)
  printJob.setOutputName  ("StreamToFileExample.png");
  printJob.setPrinterType (EPrinterType.ImagePng);

  // Generate output with the streaming API using the specified factory
  printJob.printToStreams (factory);

Parameters

Parameter / typeDescription
factoryOutputStreamFactory

Instance used to create and close streams when needed

Search documentation

Search in
More scopes
Additional scopes

All contents