Print File Hook
The PrintFileHook is an optional DLL that, when set, will be called before data is send to the printer. This makes it possible to manipulate the print data before it is printed.
With a PrintFileHook you could for example add escape sequences, change certain text or characters, automatically reduce font size and so forth.
Currently to make full use of a PrintFileHook, you must send the print requests from the comscript library to be able to send parameters with the request.
Creating a PrintFileHook
PrintFileHooks are very customer specific and for most cases have been created during the migration projects, but it is possible to create one yourself.
The created PrintFileHooks must adhere to the following criteria's:
- It must be created using a class named "PrintFileHook"
- This "PrintFileHook" class must contain a method called "ModifyPrintData" with the following parameters.
- "data" The print data.
- "station" The station of the user requesting the printjob.
- "user" The user requesting the printjob.
- "printer" The printer to where the printjob is being send.
- "parameter" A parameter to be called from the comscript library Print Interface , HookParameters.
An example of the mandatory sections:
///<summary>
/// Hook for every file that is printed by the printcontroller.
///</summary>
public class PrintFileHook {
...
...
...
/// <summary>
/// Called by the printcontroller before a file is printed.
/// </summary>
/// <param name="data">print data</param>
/// <param name="station">station</param>
/// <param name="user">user</param>
/// <param name="printer">printer</param>
/// <param name="parameter">parameter</param>
///<returns>modified print data</returns>
public String ModifyPrintData (String data, String station, String user, String printer, String parameter) {
...
...
...
return (result);
} // ModifyPrintData
} // Class PrintFileHook
/// Hook for every file that is printed by the printcontroller.
///</summary>
public class PrintFileHook {
...
...
...
/// <summary>
/// Called by the printcontroller before a file is printed.
/// </summary>
/// <param name="data">print data</param>
/// <param name="station">station</param>
/// <param name="user">user</param>
/// <param name="printer">printer</param>
/// <param name="parameter">parameter</param>
///<returns>modified print data</returns>
public String ModifyPrintData (String data, String station, String user, String printer, String parameter) {
...
...
...
return (result);
} // ModifyPrintData
} // Class PrintFileHook