Modules | Classes | Functions
Printer Driver API

Interfaces and functions required to implement a printer driver. More...


 Printer Driver Parameter Interfaces and Data types
 Parameter interfaces and data types for printer drivers.


struct  IPrinterDriverBase
 Base printer driver interface. More...
struct  IPrinterDriverOutputVector
 Printer driver output vector interface. More...
struct  IPrinterDriverOutputPath
 Printer driver output path interface. More...
struct  IPrinterDriverOutputRaster
 Printer driver output raster interface. More...


void mdlPlot_registerIPrinterDriver (IPrinterDriverBaseP printerDriver)
 Registers a printer driver with the print engine. More...

Detailed Description

Interfaces and functions required to implement a printer driver.

Printer drivers primarily implement the IPrinterDriverBase interface, and must "#include <Mstn/Plot/IPrinterDriver.h>" in addition to "#include <Mstn/Plot/PlotApi.h>". They must also implement one or more IPrinterDriverOutput interfaces, depending upon their capabilities.

Printer drivers are registered using the mdlPlot_registerIPrinterDriver method. They may also register key-in commands that can be specified in a .plt file designed for the printer driver. The printer driver .MA and .DLL are loaded immediately after the printer driver configuration file is read, based on the .plt driver property. At that time the printing system calls the driver's PreLoad method. That gives the driver the opportunity to establish default values for optional parameters. Next the key-in commands defined in the .plt file are sent, allowing the user to override those default parameter values.

The printer driver is unloaded whenever the print submittal application switches to a new printer driver, but is not unloaded when switching to a different .plt file targeting the same printer driver. The PreLoad / key-in sequence is repeated whenever a printer driver configuration file is loaded or reloaded.

It is possible to use .pltcfg files in conjunction with custom printer drivers, but since the .pltcfg XML schema is undocumented, use of .plt files is assumed.

During the DriverLoad event, which is invoked on a per-page basis, the printer driver is expected to configure the print engine as needed based on the printer driver capabilities and any relevant user-configurable printer driver configuration properties. For example, for performance reasons the print engine does not normally provide support for associating input elements with stroked graphical output primitives. If such support is needed, the printer driver must request it. Also, by default the print engine opens and manages the plot file, taking into account pseudo-filenames such as TCP/IP addresses and UNC shares. If the printer driver needs to manage the output file itself (or does not support file output), it can instruct the print engine to not create or write to a plot file.

Note that printer drivers that implement IPrintSetEventHandler and can produce collated multi-page output, such as the PDF printer driver and the system printer driver, are loaded into both the primary and worker processes. They cannot share any data between the methods that execute in the different processes, except through a private inter-process communication channel that the printer driver must implement if it needs one. The driver loaded into the worker process is subject to being unloaded and reloaded as the worker process is terminated and restarted during print set processing.

Printer drivers make heavy use of the IPlotter and IPrintEngine interfaces. Unlike print submittal applications, printer drivers are expected to call IPlotter "set" methods in addition to "get" methods. The IPlotter and IPrintEngine interfaces serve as a communication channel between the printer driver and the print engine, in addition to the one-way IPrinterDriver calls from the print engine to the printer driver.

Printer drivers may display a user interface during some events if required, but must refrain from doing so when running in the context of the non-graphics worker process.

Function Documentation

void Bentley::MstnPlatform::mdlPlot_registerIPrinterDriver ( IPrinterDriverBaseP  printerDriver)

Registers a printer driver with the print engine.

Must be called from the printer driver's entry point and at no other time. Required library: Bentley.PrintFoundation.lib

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.