DocumentViewer.loadDocument() attaching iFrames

PDFTron Web

Product Version:

Please give a brief summary of your issue:
I am running PDFTron with my custom UI. When I load a pdf with documentViewer.loadDocument() an iFrame gets appended to my body:

Deleting the iFrame does not impact the functionality.

Please describe your issue and provide steps to reproduce it:
Set up a like described here:

and load a document.

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hello jherbe,

Each time you call loadDocument() does it append an iFrame? or are you curious why the iFrame is being added?

Tyler Gordon
Web Development Support Engineer

Hi Tyler,

thanks for your response!
The iFrame is only attached the first time loadDocument is called. I am curious if this is needed or if I can get rid of it.


Hello jherbe,

If you notice no changes with the custom UI when removing it, it should be okay to remove. You can read more about WebViewer’s iframe here: PDFTron Systems Inc. | Documentation

Best regards,
Tyler Gordon
Web Development Support Engineer

Okay. I was wondering if this might be a bug, when using core only.

Some clarification here. This iframe is used for running embedded JavaScript that is inside some PDF files. It will be added regardless of whether you’re using the default WebViewer UI or WebViewer without an iframe. To clarify, this is not a bug.

Here is some more information about embedded JavaScript and how to disable it

Hi Matt,

thank you for the input! Makes sense.