Printing report viewer

Hello everyone, I need to print a report viewer that is located only here:

I am not using the component inside a window part of the project, I just need to call the report and print it by a button and I have this code:


Thank you so much for your help.

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* functions. If the printer is reachable from the gateway, consider using to send the print job directly to the printer.

I found the function: = "My Path" , project = "MyProject" , parameters = overrides, fileType = "pdf" )

But, am I need to put all parameters that says ?

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.

So, If my printer is reachableI just need to use ?

It will be like this:

settings = { "path" : "C:\\Ignition Reports" , "fileName" : "Report.pdf" , "format" : "pdf" } = "My Report Path" , project = "My Project" , action = "print" , actionSettings = settings)

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.)

And don't forget to supply parameters for the report itself.

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.

Yes, I mean, don't change the word path, I waas trying to say the value , and I tried to do this but don't do anything.

settings = {"path":"C:\\Users\\Em\\Desktop", "fileName":"Report.pdf", "format":"pdf"}"ejemplo", project="Prueba", action="save", actionSettings=settings)

I tried first just saving the report

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 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.

{ Look in your gateway log for errors produced by the attempts to save there. Very unlikely to be "nothing". }