That would get a reference to a component in the window with the button. ejemplo is a report, not a component. You will need to execute the report using one of the system.report.execute* functions. If the printer is reachable from the gateway, consider using system.report.executeAndDistribute() to send the print job directly to the printer.
Yes, you need to supply all parameters. Also, the return value is the byte array of the PDF. You then have to print that, which isn't very convenient. Which is why I recommend the other function.
Reachable by the gateway (that's where reports are generated). If your action is print, you supply action settings for "print" to designate the printer to target. (Your sample has action settings for "save", which would save into the gateway's filesystem.)
OK, so the path in 'settings' is where the reports are generated in the computer and in the function executeAndDsitribute , the ''path" is the name that my report has?
No, when printing, you don't supply path or fileName or format in your actionSettings. You supply primaryPrinterName and/or backupPrinterName and so on. When just printing, the PDF isn't saved to disk anywhere.
Use path, fileName, and format when using the save action. Then the gateway filesystem gets the result.
Please take a closer look in the docs where all of the actionSettings are described.
Does your gateway service have access to your user home desktop? The gateway background process is what creates and then saves or prints or emails your report. The gateway service generally does not have access to user home directories. And it is usually pointless, as most installs don't have users logging into the server's desktop.
If you want to save locally in Vision, use system.report.executeReport() and then system.file.writeFile() to write the bytes of the PDF where you want them.
Saving and printing are sufficiently different that the easiest solution is different for each.