Problem to export a screen into a pdf - javascript trigger

Jan 27, 2021

Hi, 

I'm trying to export a screen from my Storyline content into a PDF by using a javascript code I found here. The script kind of work, the only problem I have is the size of the content in this PDF. The size depends on the size of the screen of the user. If the user has a big screen, the content is cut off on the right, and if he has a small screen the content is clearly too small in the PDF. 

Do you think I could change something in this script to fix this issue and have the content exported in a constant size relative to the PDF ?

 

Here is a visual example of what I mean :big screen

small screen

This is the script I'm using :

var styles = `@media print {
body, * { visibility: hidden; }
html, body { overflow: hidden; transform: translateZ(0); }
#slide {
transform: scale(1) !important;
}
#wrapper {
transform: scale(1) !important;
}
#slide,
#wrapper {
width: 100% !important;
height: 100% !important;
overflow: visible !important;
}
#frame {
overflow: visible !important;
}
.slide-transition-container {
overflow: visible !important;
}
@page {size: A4 landscape;max-height:99%; max-width:99%}
.slide-container, .slide-container * {
visibility: visible !important;
margin-top: 0px !important;
margin-left: 0px !important;
}
#outline-panel {
display: none !important;
}
}
}`
var stylesheet = document.createElement('style');
stylesheet.type = 'text/css';
stylesheet.innerText = styles;
document.head.appendChild(stylesheet);
window.print();

Be the first to reply