Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
onLoadingEnd: null,
onPrintDialogClose: () => {},
onIncompatibleBrowser: () => {},
onAfterPrint: () => {},
modalMessage: 'Retrieving Document...',
frameId: 'printJS',
frameRemoveDelay: null,
Expand Down
11 changes: 10 additions & 1 deletion src/js/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,24 @@ function performPrint (iframeElement, params) {
// If Edge or IE, try catch with execCommand
if (Browser.isEdge() || Browser.isIE()) {
try {
iframeElement.contentWindow.onafterprint = function (event) {
params.onAfterPrint.call(this,event)
}
iframeElement.contentWindow.document.execCommand('print', false, null)
} catch (e) {
setTimeout(function(){
iframeElement.contentWindow.onafterprint = function (event) {
params.onAfterPrint.call(this,event)
}
iframeElement.contentWindow.print()
},1000)
}
} else {
// Other browsers
// Other browsers
setTimeout(function(){
iframeElement.contentWindow.onafterprint = function (event) {
params.onAfterPrint.call(this,event)
}
iframeElement.contentWindow.print()
},1000)
}
Expand Down