# saveAsPDF() vs. executeAndDistribute() File Location

**URL:** <https://forum.inductiveautomation.com/t/saveaspdf-vs-executeanddistribute-file-location/114968>\
**Category:** Ignition\
**Tags:** scripting, vision, ignition81\
**Created:** [April 8, 2026, 9:56pm UTC](https://forum.inductiveautomation.com/t/saveaspdf-vs-executeanddistribute-file-location/114968 "2026-04-08T21:56:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbennett.tdc](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@tbennett.tdc](https://forum.inductiveautomation.com/u/tbennett.tdc)\
**Post date:** [April 8, 2026, 9:56pm UTC](https://forum.inductiveautomation.com/t/saveaspdf-vs-executeanddistribute-file-location/114968/1 "2026-04-08T21:56:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 8, 2026, 10:03pm UTC](https://forum.inductiveautomation.com/t/saveaspdf-vs-executeanddistribute-file-location/114968/2 "2026-04-08T22:03:19Z")

</div>

1. Use [`getBytesPDF()`](https://www.docs.inductiveautomation.com/docs/8.3/appendix/components/vision-components/reporting-components/report-viewer/report-viewer-scripting#getbytespdf) on the Report Viewer component to get a byte array
2. Use [`system.util.sendMessage`](https://www.docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-util/system-util-sendMessage) to send the bytes to the gateway.
3. Use a [message handler](https://www.docs.inductiveautomation.com/docs/8.3/platform/scripting/scripting-in-ignition/gateway-event-scripts#message-scripts) to receive the incoming bytes and [`system.file.writeFile`](https://www.docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-file/system-file-writeFile) to save the binary data out as a file.
