# Use PDF from DB to view in PDF viewer in perspective using WebDev

**URL:** <https://forum.inductiveautomation.com/t/use-pdf-from-db-to-view-in-pdf-viewer-in-perspective-using-webdev/59515>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 12, 2022, 6:25pm UTC](https://forum.inductiveautomation.com/t/use-pdf-from-db-to-view-in-pdf-viewer-in-perspective-using-webdev/59515 "2022-05-12T18:25:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user66](https://avatars.discourse-cdn.com/v4/letter/u/b487fb/32.png) [@user66](https://forum.inductiveautomation.com/u/user66)\
**Post date:** [May 12, 2022, 6:25pm UTC](https://forum.inductiveautomation.com/t/use-pdf-from-db-to-view-in-pdf-viewer-in-perspective-using-webdev/59515/1 "2022-05-12T18:25:59Z")

</div>

Hi,  
I want to display a PDF in PDF viewer in perspective that is saved in DB in blob format using WebDev.

this is the code I wrote in WebDev doget()

`my_pdf=system.db.runNamedQuery(` `"folderName/myNamedQuery"` `, {})`  
`return {'contentType':'application/pdf','bytes':my_pdf}`

The above code doesn’t seem to work  
how can this be done?

---

<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 12, 2022, 7:12pm UTC](https://forum.inductiveautomation.com/t/use-pdf-from-db-to-view-in-pdf-viewer-in-perspective-using-webdev/59515/2 "2022-05-12T19:12:34Z")

</div>

Named queries return a dataset. You need to pull the blob content out of the dataset. Something like this:

```auto
myds=system.db.runNamedQuery( "folderName/myNamedQuery" , {})
my_pdf = myds.getValueAt(0, 'myBlobColumnName')
return {'contentType':'application/pdf','bytes':my_pdf}

```

---

<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 12, 2022, 7:13pm UTC](https://forum.inductiveautomation.com/t/use-pdf-from-db-to-view-in-pdf-viewer-in-perspective-using-webdev/59515/3 "2022-05-12T19:13:31Z")

</div>

You might also find this helpful:

> [@Automation Professionals' Blob Server Module](https://forum.inductiveautomation.com/t/automation-professionals-blob-server-module/57970):
>
> Automation Professionals is pleased to announce an alpha release of its new Blob Server Module. Available only for Ignition v8.1, here. The Blob Server Module provides a simple way to deliver images, PDF files, or other binary content from a database to your Perspective clients or other web applications. Without needing the WebDev module. All you need is a Named Query that has appropriate security settings and returns a single row with two columns: Content, and ContentType. Modest documentati…
