Skip to content

Commit

Permalink
fixed image print blank preview
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed Jan 11, 2017
1 parent cea9811 commit fe07a45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/print.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ module.exports = {
// Internet Explorer 6-11
isIE () {
return !!document.documentMode
},

// Chrome 1+
isChrome () {
return !!window.chrome && !!window.chrome.webstore
}

// Opera 8.0+
Expand All @@ -17,7 +22,4 @@ module.exports = {

// Edge 20+
// let isEdge = !isIE && !!window.StyleMedia

// Chrome 1+
// let isChrome = !!window.chrome && !!window.chrome.webstore
}
4 changes: 2 additions & 2 deletions src/js/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ PrintJS.prototype.print = function () {
// inject printable html into iframe body
printDocument.body.innerHTML = print.params.htmlData

// wait for image to load inside iframe
if (print.params.type === 'image') {
// wait for image to load inside iframe (chrome only)
if (print.params.type === 'image' && browser.isChrome()) {
printDocument.getElementById('printableImage').onload = function () {
finishPrint()
}
Expand Down

0 comments on commit fe07a45

Please sign in to comment.