# PDF Viewer doesn't render embedded images

**URL:** <https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082>\
**Category:** Ignition\
**Tags:** vision, ignition79\
**Created:** [January 9, 2021, 12:53am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082 "2021-01-09T00:53:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [January 9, 2021, 12:53am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/1 "2021-01-09T00:53:14Z")

</div>

Hi folks,

Ignition 7.9.6

I’m working with a user manual PDF from a contractor, and the client would like it available in a PDF reader in the client. I’ve tried pointing the PDF reader directly at the PDF, as well as uploading to the database as a blob.In both instances, none of the images within the PDF load, while text and table load just fine. If I export the pages to image files and create a new PDF from them, none of the information on the pages loads, and it just displays 18 blank pages.

I have not been able to find anything specifically regarding images in PDFs not loading, though I see that the PDF reader has limited support and known shortcomings in 7.9. I understand if its not possible, just looking for some guidance and to help save some time if this cannot be accomplished.

Cheers,  
Andrew

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 9, 2021, 7:23am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/2 "2021-01-09T07:23:59Z")

</div>

Can you post your code (Jython script) for the BLOB method?

And attach said PDF if you are allowed?

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [January 11, 2021, 7:01pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/3 "2021-01-11T19:01:11Z")

</div>

Happy to share what I can. I cannot share the specific user manual, but I have a couple other documents that mimic the behavior I am seeing. I’ve attached 2 files that do not render images or whole pages when displayed, either using a blob or directly specifying the file path from the PDF viewer.

[SI6700 Spec.pdf](https://forum.inductiveautomation.com/uploads/short-url/ho8IHuhS3W2sdnQvUcQ3TQ4991h.pdf) (390.7 KB)  
[Moxa-Mgate-5105.pdf](https://forum.inductiveautomation.com/uploads/short-url/l5doZysiFRTrQTfHxIuDtzmzunc.pdf) (720.1 KB)

Blob upload script (taken straight from [Ignition user manual](https://docs.inductiveautomation.com/display/DOC79/Storing+Files+in+a+Database)):

```auto
# Find the path to the PDF file.
path = system.file.openFile("pdf")
 
# Check to ensure that the user actually selected a filepath.
if path != None:
 
    # Read the file as bytes.
    data = system.file.readFileAsBytes(path)
 
    # Ask the user to enter in a filename.
    # Will grab just the filename and extension from the path as a suggestion.
    name = system.gui.inputBox("Enter a name for the file", path.split('\\')[-1])
 
    # Check to ensure that the user entered a name for the file.
    if name != None:
 
        # Insert the data and name into the database.
        system.db.runPrepUpdate("INSERT INTO File_Storage (FileName, Data) VALUES (?,?)", [name,data])

```

And displaying that document. For now I am manually setting the ID, until I am confident we can get this working.

```auto
#ID of user manual in File_Storage Folder
id = 7

#Query for the raw pdf data by using the id.
bytes = system.db.runScalarQuery("SELECT Data FROM File_Storage WHERE FileID_ndx = %d" % id)  
name = system.db.runScalarQuery("SELECT FileName FROM File_Storage WHERE FileID_ndx = %d" % id)

#Load the bytes and the name into the PDF viewer component.
event.source.parent.getComponent('PDF Viewer').loadPDFBytes(bytes, name)

```

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 12, 2021, 11:28am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/4 "2021-01-12T11:28:42Z")

</div>

Let me run some tests on 7.9.X with alternate code. Have a meeting this afternoon (UK time zone) that I need to prep for.

Will report back, no pun intended, if no one else beats me to it 🙂

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 20, 2021, 7:49pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/5 "2021-01-20T19:49:21Z")

</div>

So I ran your code on 7.9.12 with MySQL 5.7.29

The only thing I had to change was a LONGBLOB not BLOB for the column type for PDF bytes.

I tweaked a few names just for testing, results look ok to me

```auto
def insert():
	# Find the path to the PDF file.
	path = system.file.openFile("pdf")
	 
	# Check to ensure that the user actually selected a filepath.
	if path != None:
	 
	    # Read the file as bytes.
	    data = system.file.readFileAsBytes(path)
	 
	    # Ask the user to enter in a filename.
	    # Will grab just the filename and extension from the path as a suggestion.
	    name = system.gui.inputBox("Enter a name for the file", path.split('\\')[-1])
	 
	    # Check to ensure that the user entered a name for the file.
	    if name != None:
	 
	        # Insert the data and name into the database.
	        system.db.runPrepUpdate("INSERT INTO testing (name, data_blob) VALUES (?,?)", [name,data])

def retrieve():      
                        
	#ID of user manual in File_Storage Folder
	id = 1
	
	#Query for the raw pdf data by using the id.
	bytes = system.db.runScalarQuery("SELECT data_blob FROM testing WHERE idtesting = %d" % id)  
	name = system.db.runScalarQuery("SELECT name FROM testing WHERE idtesting = %d" % id)
	
	#Load the bytes and the name into the PDF viewer component.
	event.source.parent.getComponent('PDF Viewer').loadPDFBytes(bytes, name)        
	
	
insert()	
#retrieve()	

```

 ![pdfTest](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d2b629c810716c9a333b59d82c3d968ad201dd7d.png)

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [January 21, 2021, 6:03pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/6 "2021-01-21T18:03:55Z")

</div>

Thanks for checking.  
This client is running on 7.9.6 - I’ll spin up a 7.9.7/8/9/10 and see if / where this functionality shows up. I suspect it’s just an ignition version issue.

I’ll let you know what I find out.

Cheers!

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [January 22, 2021, 12:20am UTC](https://forum.inductiveautomation.com/t/pdf-viewer-doesnt-render-embedded-images/42082/7 "2021-01-22T00:20:20Z")

</div>

Confirmed on 7.9.12 with MSSQL that the PDF viewer has no problem displaying the PDFs in question.  
I assume its an Ignition version issue, but I can’t find any more information. Maybe someone at IA will have more insight.

Cheers!
