Chrome Blank Pdf Print Preview

Chrome print blank page

It looks like it's attempting to print before the <img> has loaded, move the call to print inside an event handler for the load event of window by opening the link as a data URI or Blob, for example

var code = '\
<html>\
<head>\
<title></title>\
<script>\
function printFunction() {\
window.focus();\
window.print();\
window.close();\
}\
window.addEventListener(\'load\', printFunction);\
</script>\
</head>\
<body><img src="'+src+'" width="300"></body>\
</html>';

window.open('data:text/html,' + code, '_blank', 'width=600,height=600');

Don't forget you may need to HTML encode the tags in code


You could probably just listen for load on the <img> instead, but if you ever do anything more complicated than tring to print a single image you may find it breaks again in future

doc.write('<img onload="printFunction();" src="'+src+'" width="300">');

Where printFunction is the print function for all browsers

Google chrome prints extra page

Seems issue is with the padding. Try to adjust padding for .entry-wrap for media print.

May be something like below

@media print {
.entry-wrap {
padding: 25px; /* adjust it accordingly */
}
}

Hope this will help you someway (y).

google chrome print preview does not load the page the first time

You need to put delay before print.
There is a native defect in chrome.

Code would as under :-

function PrintDiv(data) {
var mywindow = window.open();
var is_chrome = Boolean(mywindow.chrome);
mywindow.document.write(data);

if (is_chrome) {
setTimeout(function() { // wait until all resources loaded
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10
mywindow.print(); // change window to winPrint
mywindow.close(); // change window to winPrint
}, 250);
} else {
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10

mywindow.print();
mywindow.close();
}

return true;
}

Chrome print preview error

Finally i found the error. 2 css rules have blocked the browser from generating the preview:

min-height: 100%;
height: 100%;

and

position: fixed;

How to print pdf silently which is opened by Adobe Reader

You can't... at least not with Adobe Reader.

First, Chrome no longer supports the Adobe Reader for displaying PDF so the PDF will either open in the built-in Chrome viewer or will download and open in Adobe Reader depending on your settings.

Second, the JavaScript methods to control printing from Adobe Reader are privileged functions that require user permission to execute.

You can get around these limitations but it requires that the recipient of the PDF establish trust with either a digital certificate that you sign the PDF with or trust your domain. But in all cases, the user must opt-in before printing will execute silently... so... it's not exactly silent.



Related Topics



Leave a reply



Submit