Print Report

Prints a report template on the selected printer.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

printReport --usedefaultprinter(Boolean) --printername(String) --asset(String) [--automap(Boolean)] --mappings(String) --watermark(ReportWatermark) --text(String) --textcolor(String) [--textfont(String)] --textsize(Numeric) --image(String) --transparency(Numeric) [--pagerange(String)] (Numeric)=pagecount

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Use default printer usedefaultprinter Required Boolean When enabled, uses the system's default printer.
Printer name printername Only when Use default printer is False Text Name of the printer that prints the report.
Asset asset Required Text Asset that contains the report template.
Automap automap Optional Boolean When enabled, maps variables that have the same name as the report parameters.
Mappings mappings Only when Automap is False Text, Database connection Maps which variables will fill the report parameters. The Parameter field receives the report name and the Value field receives the variable with the value. Check the Example to have a context on how to use it.
Watermark watermark Required ReportWatermark Watermark present in the report. The command accept the following types: Image, Text, or None.
Text text Only when Watermark is Text Text Text used as a watermark.
Text color textcolor Only when Watermark is Text Text Color of the text, in hexadeimal format.
Text font textfont Only when Watermark is Text Text Text font to use in the watermark.
Text size textsize Only when Watermark is Text Number Font size used.
Image image Only when Watermark is Image Text, Image Image used as a watermark.
Transparency transparency Only when Watermark is Text or Image Number Degree of transparency of the watermark.
Page range pagerange Optional when Watermark is Text or Image Text Range of pages where the watermark will be set.

watermark parameter options

The following table displays the options available for the watermark input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Image image The watermark is an Image.
Text text The watermark is a Text.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Page count pagecount Number Return the amount of printed pages.


After generating a report, in PDF format, which is arranged as a table with the data "Name", "Age", "CPF" and "RG" of a user, the command Print Report (printReport) prints this report on the printer system default.

defVar --name excelFile --type Excel
defVar --name excelDefine --type Excel
defVar --name obtainedExcelFile --type DataTable
defVar --name row --type Numeric
defVar --name obtainedExcelTableRows --type Numeric
defVar --name obtainedExcelTable --type DataTable
defVar --name name --type String
defVar --name age --type String
defVar --name reportPath --type String
defVar --name reportPath1 --type Numeric
// Open both excel files.
excelOpen --file "excelFile.xlsx" excelFile=value
excelOpen --file "excelToDefine.xlsx" excelDefine=value
// Gets the table from the `excelFile`.
excelGetTable --file ${excelFile} --getfirstsheet  --entiretable  --hasheaders  obtainedExcelFile=value
for --variable ${row} --from 1 --to ${obtainedExcelTableRows} --step 1
	mapTableRow --dataTable ${obtainedExcelTable} --row ${row} --mappings "number=1=${name},number=2=${age}"
	excelSet --value "${name}" --file ${excelDefine} --getfirstsheet  --row ${row} --column 1
	excelSet --value "${age}" --file ${excelDefine} --getfirstsheet  --row ${row} --column 2
	// Creates a report in PDF format.
	exportReport --format "Pdf" --title "Table Report" --watermark "None" --createrandomfile  --asset "exampleReport.repx" --mappings "Name=${name},Age=${age}" reportPath=filepath
// Prints the report.
printReport --usedefaultprinter  --asset "exampleReport.repx" --mappings "Name=${name},Age=${age}" --watermark "None"
logMessage --message "PDF report: ${reportPath}\r\nExcel 1: ${excelFile}\r\nExcel 2: ${excelDefine}" --type "Info"