Printing User Notes with Linebreaks and Whitespace

Mar 03, 2021

Hello all,

I'm attempting to set up a lightbox page where users can take notes throughout the course and then print the notes at the end. I've got a bit of JavaScript set up so that I am able to pull the information from the text entry and print it. However when it prints, it prints as a giant paragraph instead of including the linebreaks and white space. Which makes it really hard to read. Does anyone have a solution to this? I haven't been able to figure it out.

Here is my script:

var myWindow = window.open("","Print","width=810,height=610,scrollbars=1,resizable=1");
var player=GetPlayer();
var date=player.GetVar("SystemDate");
var post=player.GetVar("TextEntry16");

var contents = "<html><head></head><body style='width:650px;padding:20px;'>"
contents+="<div style='font-size:26px;font-weight:bold;margin-top:10px;'>My Notes on the Verification Process</div>";
contents+="<div style='font-size:17px;margin-top:5px;'>"+post+"</div>";
contents+= "</body></html>"
myWindow.document.write(contents);
myWindow.print();

 

 

I've also attached a couple of screen shots so you can see what my results currently look like. I appreciate any help I can get.

Be the first to reply