Job.PrintToStreams method

PrintToStreams

void PrintToStreams(CreateStreamDelegate fnCreate, CloseStreamDelegate fnClose)

Referenced types: CreateStreamDelegate, CloseStreamDelegate

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

The output is provided via multiple output streams created and closed by the provided delegates.

Example

Supply delegates to create and close a stream for each requested output name:

//-------------------------------------------------------------------------------------------
// Delegate to create a new stream
// This delegate will be called for each requested stream before any output is generated
// You may use this delegate to open files or to reserve memory
//-------------------------------------------------------------------------------------------
Stream CreateStream (string sName)
{
  // For demonstration purposes we create a file stream
  Stream stream = new FileStream (sName, FileMode.Create);
  return stream;
}

//-------------------------------------------------------------------------------------------
// Delegate to close a stream
// This delegate will be called for each requested stream if it is no longer used
// You may use this delegate for cleanup purposes
//-------------------------------------------------------------------------------------------
void CloseStream(Stream stream)
{
  stream.Close ();
}

This example selects PNG output and uses OutputName as the basis for the stream names passed to the create delegate. Page-based output can produce several names.

  // 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.OutputName = "StreamToFileExample.png";
  printJob.PrinterType = PrinterType.ImagePng;

  // Generate output with the streaming API using the specified delegates
  printJob.PrintToStreams (CreateStream, CloseStream);

Note

Throws an exception if a valid license is expired (ERR_TF_LICENSE_EXPIRED)

Parameters

Parameter / typeDescription
fnCreateCreateStreamDelegate

Delegate function to create a new stream

fnCloseCloseStreamDelegate

Delegate function to close a stream

Search documentation

Search in
More scopes
Additional scopes

All contents