# ReadFileAsBytes into Perspective PDF Viewer

**URL:** <https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 21, 2026, 10:34am UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635 "2026-05-21T10:34:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 21, 2026, 10:34am UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/1 "2026-05-21T10:34:56Z")

</div>

Hi,

Is it possible to use fonction system.file.readFileAsBytes() and put the result into a Perspective PDF Viewer ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2026, 12:10pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/2 "2026-05-21T12:10:17Z")

</div>

With the WebDev module. (If you mean a file in the machine running the browser, no, not at all.)

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 21, 2026, 12:22pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/3 "2026-05-21T12:22:46Z")

</div>

Yes I made an API Post request to send me bytes of a PDF file on my server.

But How can I use my received bytes in my PDF Viewer ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2026, 12:25pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/4 "2026-05-21T12:25:11Z")

</div>

Make it a GET request so you can put the URL in the viewer.

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 21, 2026, 2:01pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/5 "2026-05-21T14:01:06Z")

</div>

It works.  
How can I use basic Auth securely ?

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 21, 2026, 2:07pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/6 "2026-05-21T14:07:36Z")

</div>

Is it possible to download the showed PDF in the component ?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [May 21, 2026, 4:52pm UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/7 "2026-05-21T16:52:16Z")

</div>

> [@flavien](#):
>
> download the showed PDF

Pass the bytes provided by the get request to a call to [`system.perspective.download`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-download)

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [May 22, 2026, 7:14am UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/8 "2026-05-22T07:14:38Z")

</div>

I'm passing the GET URL directly into the PDF Viewer's source prop. How can I access the raw bytes inside the component? I know I could make a separate request to fetch them and download the pdf, but I'd prefer to handle it in a single request.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 22, 2026, 11:45am UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/9 "2026-05-22T11:45:23Z")

</div>

> [@flavien](#):
>
> raw bytes inside the component?

You cannot. You need to make a separate button that either generates the bytes independently for `system.perspective.download()`, or links to the same URL for the browser to handle the download itself.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 22, 2026, 11:53am UTC](https://forum.inductiveautomation.com/t/readfileasbytes-into-perspective-pdf-viewer/115635/10 "2026-05-22T11:53:46Z")

</div>

> [@flavien](#):
>
> handle it in a single request

If the report is complex, consider caching the result for a short time, so the separate requests don't multiply the workload.
