Reporting with Panels (Silent print)

When using the command line option -silentMode, the user interface runs in the background without a graphical display. It allows you to print any panel. The User Interface is opened in the Silent Mode with the following command line option (see also CTRL function printRootPanel() ):

WCCOAui -silentMode
CAUTION: Print jobs are not buffered or processed sequentially. If a new print job is generated while processing the current job, the new job will be ignored.

You can see the status of the current or last print job in the attribute _SilentPrint of the internal data point _Ui:

Status Meaning
1 Processed successfully, waiting for new jobs
2 Aborted by user
3 Waiting (for example, until all CTRL scripts have been processed)
4 Error (for example, could not read the panel)
Note: The jobs are only printed after all CTRL scripts of the panel to print have been completely finished (for example, all responses have been displayed).

The following elements allow specifying how a panel should be printed (in addition there is the config entry silentPrintWithBorder), see the following example:

Data point element at the DP node _Ui_X.Print ("X" stands for the number of the UI) Data type Description
.PrinterName string

Printer name or file name.

In silent mode or without print dialog, the printout can be also redirected to a local file. The supported formats are PDF (*.pdf) and Postscript (*.ps).

Syntax:

"file:///path/file.pdf";

Examples:

Linux: "file:///tmp/file.pdf";

Windows: "file:///C:/Temp/file.ps";

.Landscape bool Landscape/Portrait
.Background bool Off = the background color of the panel is printed in white
.Scale float Scaling factor
.FitToPage bool Allows scaling irrespective of the printer

A print job is started or canceled by setting the attributes of the internal User Interface data point (the _Ui data point), for the manager that is running in the background via a dpSet() function.

The following example shows how to print a panel in the silent mode and how to set the printer settings. A panel will be printed using landscape format and fitted to page. Note that you do not see any automatic message of the print job in the log viewer (except the DebugN() of this function). The panel will be printed on the default printer. Note that a user interface with the number 4 has to run in the silent mode. Thus, start a UI with the number 4 and using the option -silentMode.

main()
{
  dyn_string dynStringVar = makeDynString();
  int res;
  res = dpSet("_Ui_4.RootPanelOrigOn.ModuleName", "module1",
  "_Ui_4.RootPanelOrigOn.FileName", "silentMode.pnl",
  "_Ui_4.RootPanelOrigOn.PanelName", "silentMode",
  "_Ui_4.RootPanelOrigOn.Parameter", dynStringVar,
  "_Ui_4.Print.Landscape", TRUE,
  "_Ui_4.Print.Background", FALSE,
  "_Ui_4.Print.Scale", 0,
  "_Ui_4.Print.FitToPage", TRUE);
  DebugN("Function successful", res);
}

The following example shows how to cancel the above print job after it was started. In this case, the panel "silentMode" is not printed.

main()
{
  int Abbrc;
  Abbrc = dpSet("_Ui_4.PanelOff.ModuleName", "module1",
  "_Ui_4.PanelOff.PanelName", "silentMode");
  DebugN("Cancel print job", Abbrc);
}
Note: Multiple modules can be printed with the function printRootPanel().
Note: Silent print does not print the trend plot when legend is visible. For that reason hide the legend before print.