Printer package guide
Read and change installed printer configuration on Windows.
Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
These actions read or change the printers installed in Windows for the Run user. They do not print. Use the exact printer name.
For Remove, use only a test printer such as Sample PDF Printer. A missing printer or missing rights cause a Windows error.
Actions
Get default (printerGetDefault)
Gets the name of the default printer of the Run user.
Inputs
No inputs.
Outputs
| Output | Type | Meaning and binding |
|---|---|---|
result | String | Default printer name, or "" when Windows has none. Bind it to a String variable such as default. |
Example
With test printer Sample PDF Printer as default, bind result to String defaultPrinter.
Expected result
result is Sample PDF Printer for that setup. With no default printer, the result is "".
Remove (printerRemove)
Removes an installed printer from Windows.
Inputs
| Input | Editor field | Type and runtime default | Use |
|---|---|---|---|
printer | Enter the printer name: | String; "" | Required. Exact name of an installed printer, such as Sample PDF Printer. Spaces around it are removed. The Run user needs full access (admin rights) to the printer. |
Outputs
No output variables.
Example
Create test printer Sample PDF Printer with no pending print jobs. Set Enter the printer name:=Sample PDF Printer to remove it.
Expected result
Windows removes the printer when it has no pending print jobs. A blank or unknown name, or missing rights, fails.
Set default (printerSetDefault)
Sets an installed printer as the default printer of the Run user.
Inputs
| Input | Editor field | Type and runtime default | Use |
|---|---|---|---|
printer | Enter the printer name: | String; "" | Required. Exact name of an installed printer that the Run user can use, such as Sample PDF Printer. Spaces around it are removed. |
Outputs
No output variables.
Example
Use an installed test printer named Sample PDF Printer. Set Enter the printer name:=Sample PDF Printer, then run Get default into defaultPrinter.
Expected result
Get default returns Sample PDF Printer when Windows accepts the change. A blank or unknown name, or missing rights, fails.