问题
how did not zoom content on printing when browser zoom? on zoom browser printing(use iframe) should not changed i try:
document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(' + scale + ')';
but it's not correctly when page very long
回答1:
This could help to disable zooming overall.
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport'>
回答2:
I use next code:
const updateSizePrintPage = () => {
let scale = 1 / window.devicePixelRatio;
document.getElementById('print-page').style.transform = 'scale(' + scale + ')';
document.getElementById('print-page').style.transformOrigin = 'top left';
};
window.addEventListener('resize', updateSizePrintPage )
and it works for me.
来源:https://stackoverflow.com/questions/46673904/how-did-not-zoom-content-on-printing-when-browser-zoom