Using JavaScript to display an image in a HTML page for printing

Apr 02, 2018

Hi all,

I've been using a JavaScript command to create an HTML page for printing TextEntries gathered from a storyline file. I'd like to insert an image into the page using the same JavaScript.

How do I do that? And where should the image be placed?

Thanks, Ofer

1 Reply
Joshua Crigger

Hi there!

I am not sure how you currently have this set up but if you are using JavaScript to open a new window with HTML formatting you can simply add in an IMG tag with the URL of your image to resolve this.

Here is a really simple bit of JavaScript which when added to execute in your project will launch a new browser window with HTML formatted text and an embedded image.

var myWindow = window.open("", "Window with an Image", "width=500,height=500");
myWindow.document.write("<h2>Embedded Image in Popup Window</h2><p>Below you should see the Articulate 360 logo sized at 200x200 pixles. </p><img src='https://articulate.com/assets/illustrations/illustration-a360-d769be3288dfcf41dc0a6c5442f4df8358fca480e4b062069305b691097add78.png' width='200px' height='200px'>");

Here is what this should look like when executed:

Screenshot

I have also included my simple test file for your reference. Hope this helps point you in the right direction!

This discussion is closed. You can start a new discussion or contact Articulate Support.