# PDF Viewer Reading PDF From Database?

**URL:** <https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 18, 2023, 4:27am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711 "2023-01-18T04:27:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Woolnough](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Sean\_Woolnough](https://forum.inductiveautomation.com/u/Sean_Woolnough)\
**Post date:** [January 18, 2023, 4:27am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/1 "2023-01-18T04:27:47Z")

</div>

Hi Guys,

I have been playing around with Ignition for a while and seem to be stuck on this one issue, I have a SQL Database setup in which I was able to load different pdfs into it using a simple script within Ignition:

 ![Input PDF Data](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/6/c655fa191b12f46b3a4e29d5ed6cea164864f999.png)  
 ![DataBase Columns](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/771f927d57a70b48702795756de6c579c4bd83dc.png)

However my issue comes with using the PDF Viewer within Perspective to read the data from the database, I have been using the .loadPDFBytes function which I was able to find from an old Ignition tutorial however it seems to be giving me this error:

![Error2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb9abfbd2d4cbaf0d91a306240692a7d4dece927.png)

If I had to guess it seems that this function to load the PDF Bytes no longer exsists in this version of Ignition and as such this method may not work, if anyone has any other sugestions that would greatly be appreciated.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 18, 2023, 5:17am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/2 "2023-01-18T05:17:43Z")

</div>

It looks like you are trying to access a file directly from your desktop using a web browser. You're saying that you were able to do this prior to updating?

---

<div class="post-metadata">

**Author:** ![Sean\_Woolnough](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Sean\_Woolnough](https://forum.inductiveautomation.com/u/Sean_Woolnough)\
**Post date:** [January 18, 2023, 5:31am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/3 "2023-01-18T05:31:39Z")

</div>

The File has been inputted into the SQL Database as shown:

![Database](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/1/31950bde0f0a057511e23a85ca5e09db5f5fc442.png)

The problem arrises when I try to run the following script to input the byte data into the PDF Viewer:

 ![Reading Data](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/ee7febb685ada63f3e0cecc48983534a1b8bafbe.png)

I am assuming its because the .loadPDFBytes function may not be usable so was hoping theres another way to go about this issue or maybe I have missed something.

---

<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:** [January 18, 2023, 1:19pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/4 "2023-01-18T13:19:44Z")

</div>

`.loadPDFBytes()` is a method on Vision's PDF viewer. Consider using my [Blob Server module](https://forum.inductiveautomation.com/t/automation-professionals-blob-server-module/57970) to deliver your PDFs to viewers. (Free.)

Most of the examples on the forum are for images, but the same techniques should work for PDF blobs, too.

---

<div class="post-metadata">

**Author:** ![Sean\_Woolnough](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Sean\_Woolnough](https://forum.inductiveautomation.com/u/Sean_Woolnough)\
**Post date:** [January 18, 2023, 10:57pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/5 "2023-01-18T22:57:04Z")

</div>

Thank you I will take a look at this.

---

<div class="post-metadata">

**Author:** ![Zachary\_Kacel](https://avatars.discourse-cdn.com/v4/letter/z/ecb155/32.png) [@Zachary\_Kacel](https://forum.inductiveautomation.com/u/Zachary_Kacel)\
**Post date:** [May 16, 2023, 8:02pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-reading-pdf-from-database/68711/6 "2023-05-16T20:02:08Z")

</div>

I am doing something similar but I am getting my BLOB data from a webserver. You can just write the byte data to a tag then link the source of the PDF viewer to that tag.

Had to do some research on Base64 to get this working but maybe you will find this solution useful

data:application/pdf;base64,JVBERi0...........  
 ![Screenshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/7/175d1dee3620d710c6f8ef5ee824a51cf114a02e.png)
