This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pdfScript = document.createElement("script"); | |
function rescale(width, height, fitWidth, fitHeight) { | |
let ratio = width / height; | |
let fitRatio = fitWidth / fitHeight; | |
if (ratio <= fitRatio) { | |
// Dimensions to fit are wider, fix the width | |
return [width, width / fitRatio]; | |
} else { | |
// Dimensions to fit are taller, fix the height | |
return [height * fitRatio, height]; |