Print Document
Verb: printDocument
Prints a document on a specific printer.
Syntax
printDocument --file(String) [--printerExtraParameters(String)] [--selectPrinter(Boolean)] --printer(String) (Boolean)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --file | File Name | Required | Text | File path of the document that should be printed. |
| --printerExtraParameters | Additional Parameters | Optional | Text | Additional parameters to be sent for printing. |
| --selectPrinter | Select Printer | Optional | Boolean | When enabled, the name of the printer responsible for printing the document is informed. |
| --printer | Printer Name | Only whenSelect Printer is True | Text | Name of the printer to be set as the system default.
The printer name may change according to the printers available on the machine where the command is executed. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Success | Boolean | Returns "True" if the print is successful, or "False" if otherwise. |
Example
The Print Document command prints a document, obtained by the Select File command, on the default printer defined by Get Default Printer. Finally, it returns if the printing was successful.
defVar --name defaultPrinter --type String
defVar --name success --type Boolean
defVar --name documentToPrint --type String
// Select which document to print.
// fileForPDFCommandsEditable.pdf.
selectFile --filter "*.pdf" documentToPrint=value
// Get the default printer.
getDefaultPrinter defaultPrinter=value
// Print the document.
printDocument --file "${documentToPrint}" --selectPrinter --printer "${defaultPrinter}" success=value
logMessage --message "${success}" --type "Info"
// Returns the success of the impression.
Download File
For the correct operation of the above script, it is necessary to download the file and select it when the open file dialog from the Select File command appears.