saveAsPDF() vs. executeAndDistribute() File Location

I have a report that automatically saves to the gateway using a gateway tag change script which calls system.report.executeAndDistribute(). As an added feature, I originally gave the users the ability to view the report using the vision Report Viewer and to save it manually with a script that calls report.saveAsPDF().

My problem is that the “executeAndDistribute” function saves to the gateway, which is where I want it to be saved, and the “saveAsPDF” function saves to the client.

Is there a way to manually save a report I am currently viewing on the client, but save it to the gateway? I am currently re-calling the “executeAndDistribute” function, but the report takes a bit to generate, so this is undesirable.

This sounds simple, but I have not figured it out.

  1. Use getBytesPDF() on the Report Viewer component to get a byte array
  2. Use system.util.sendMessage to send the bytes to the gateway.
  3. Use a message handler to receive the incoming bytes and system.file.writeFile to save the binary data out as a file.
1 Like