• Resolved mjunes

    (@mjunes)


    Hello again,

    I observed a peculiar behavior in iOS chrome browser where in the print window opens, displays the print preview for brief second and closes automatically.

    Whereas in iOS safari the print window stays open but doesn’t show anything in the preview. Just a blank grey page.

    Any idea how to fix this?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @mjunes,

    Could you send me the link to the webpage, please?

    Best regards.

    Thread Starter mjunes

    (@mjunes)

    Please find the url in the pastebin.

    https://pastebin.com/8tLpbXid

    Thank you

    Plugin Author codepeople

    (@codepeople)

    Hello @mjunes,

    Please, replace the content into the “HTML Content” field in the form with the piece of code below. Concerning to the Chrome for iOS, unfortunately this browser does not support the code window.print

    
    <script>window['printForm']=function(selector){function _cloneCanvas(newCanvas,oldCanvas){var context=newCanvas.getContext('2d');newCanvas.width=oldCanvas.width;newCanvas.height=oldCanvas.height;context.drawImage(oldCanvas,0,0);};function _getStyles(){var r='';$(document).find('link[type*="css"],style').each(function(){r+=this.outerHTML;});return r;};function _callPrint(w){if(w&&w["printMe"]) w["printMe"]();else setTimeout(function(){_callPrint(w);},50);};try{if(typeof jQuery!='undefined'){if(typeof selector!='undefined'){var $=jQuery,f=$(selector),c,e,h,t,w,d;if(f.length){c=f.clone();c.find('script').remove();c.find('input').each(function(){e=$(this);if(typeof e.prop('checked')!='undefined') e.attr('CHECKED',e.prop('checked'));e.attr('value',e.val());});h=c[0].outerHTML;c.find('TEXTAREA').each(function(){e=$(this);t=e.parent().html();h=h.replace(t,e.val());});c.find('SELECT').each(function(){e=$(this);t=e.parent().html();h=h.replace(t,f.find('#'+e.attr('id')+' option:selected').text());});w=$('#cff_iframe_for_printing');if(w.length==0) {w=$('<iframe id="cff_iframe_for_printing" name="cff_iframe_for_printing" style="display:none;"></iframe>');w.appendTo('body');} d=w[0].contentWindow.document;d.write('<body>'+_getStyles()+h+'</body>');setTimeout(function(){d.close();$(d).find('canvas').each(function(i,e){_cloneCanvas(e,f.find('canvas:eq('+i+')')[0]);});var ua=window.navigator.userAgent,msie=ua.indexOf("MSIE ");if(msie!==0){w[0].contentWindow.document.execCommand('print',false,null);}else{w[0].contentWindow.print();}},1500);}else{throw"Form's selector is incorrect";}}else{throw'Requires the selector';}}else{throw'Requires the jQuery framework';}}catch(err){if(typeof console!='undefined') console.log(err);}};</script>
    

    Best regards.

    Thread Starter mjunes

    (@mjunes)

    Hello Codepeople,

    Thank you very much. It works in iOS Safari now.

    Plugin Author codepeople

    (@codepeople)

    Hello @mjunes,

    Thank you very much for letting me know.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Print window closes automatically’ is closed to new replies.