1. Driver API

Driver API

The PrintFactory Driver SDK lets you build your own drivers for PrintFactory. We can distribute them on a wider basis after we’ve validated them.

A driver is a DLL (Windows) or dylib (macOS) that exposes a predefined API to PrintFactory. This API provides PrintFactory with data about the capabilities of the printer or cutter, and defines how information should be sent to print etc. For the validated versions, it will also provide the license key.

DLL Export

The driver exports in three ways;

  • ListModels : this is what we use when iterating through the drivers’ folder for each driver. This method provides a list of printer/cutter names for the driver, which will be listed in the Add Output Device dialog.
  • PrinterInitialize : this is what we use to create an instance of a printer or cutter. It stays ‘live’ for as long as the RIP component or PrintStation is running. The instance will return back a number of methods for PrintFactory to use.
  • PrinterTerminate : this is what we use to delete an instance, when there’s no more need to use PrintStation at that moment in time.

Instance Methods

The list of methods passed back by PrinterInitialize comprises:

  • Info : this is what we use to query the capabilities of the device, get a UI script, ink set, trays, etc. Without a configuration XML, you’ll get the defaults; with a configuration XML (extracted from the UI script) you’ll get print mode-specific details.
  • DisposeInfo : Used to delete the data resulting from the Info call.
  • CreateSession : PrintFactory calls this at the start of a job. The CreateSession method will pass back a list of methods that the system can use to pass the print and/or cut data to the driver.
  • DisposeSession : this is what we use to delete the session created by CreateSession after a job has finished or is aborted.
  • PrinterStatus : Optional method that is called periodically to query ink levels, error state or other state information of the device. This information is visible in the RIP as well in the cloud interface.
  • JobStatus : Optional method to provide ink consumption and other status information from the printer back on the job that has been processed. If this method is not available the system will synthesise the consumption information based on the details provided by the Info call.
  • PrinterQuery : Optional general purpose API to be able to access other parts of the device besides printing or cutting, like photo spectrometers, staplers, folders, etc.
  • GetPrivateCacheData : Optional method to get persistent state information (which is stored by the driver to retain information about for example the modes available on the connected device) and store it in the configuration file that is stored in the cloud and in Backups.
  • SetPrivateCacheData : Optional method to write back persistent state information from the cloud or a Backup.

User Interface

The user interface is dynamically created from the XML based UI script. The script dictates which elements need to be presented to the user, to build a print mode, and which of these elements can be modified later by an operator without influencing the color (or any other quality aspects of the job).

After presenting the UI, the chosen settings get extracted and stored in a settings XML which is passed to the Info call. In return, we generate the list of inks, resolution, bit depth and other parameters needed to RIP a job in the format needed by the driver.

Details about the format and structure of the UI XML is documented in the Driver UI XML documentation.

Session Methods

The CreateSession method returns a list of methods that let PrintFactory pass the print or cut data to the driver (all of which are optional). The individual methods are documented in the Driver API documentation.

The RIP, spooler or PrintStation will execute the following calling sequence to pass a job to the driver:

Print

  • Initialize
  • JobStart
  • for( every layer in every page )
    • PageStart
    • RasterStart
    • for( every plane in every line )
      • ProcessRawBuffer
    • RasterEnd
    • PageEnd
  • JobEnd
  • Terminate

Cutting

  • Initialize
  • JobStart
  • for( every page )
    • RegistrationMarks (if present)
    • PageStart
    • VectorStart
    • Mix of calls below to build contours
      • SetTool
      • Move
      • Line
      • Vertex
      • PenUp
      • PenDown
      • CurveStart
      • CurveEnd
    • VectorEnd
    • PageEnd
    • Transport
  • JobEnd
  • Terminate

Print and Cut

  • Initialize
  • JobStart
  • for( every layer in every page )
    • RegistrationMarks (if present)
    • PageStart
    • RasterStart
    • for( every plane in every line )
      • ProcessRawBuffer
    • RasterEnd
    • VectorStart
    • Mix of calls below to build contours
      • SetTool
      • Move
      • Line
      • Vertex
      • PenUp
      • PenDown
      • CurveStart
      • CurveEnd
    • VectorEnd
    • PageEnd
    • Transport
  • JobEnd
  • Terminate

Example

The following example demonstrates how to create a driver that will create TIFF files as output. The sample can be cloned from GIT : https://bitbucket.org/aurelon/ada.git and does contain the sample driver as well as a bare-bones host that can be used instead of PrintFactory RIP to do the initial steps.