Skip to content

Conversation

@caseyjhol
Copy link
Contributor

This triggers the complete.printThis event after a successful print or if the dialog is simply closed. In my use case, I have to change some markup to format it properly before printing, but I needed a signal that it was okay to change it back. I'm using this with AngularJS and was running into a few issues too. A timeout seemed hacky and unreliable, so this was a perfect solution.

See a demo here: http://plnkr.co/edit/qTHfT4e4kwlmEgvnOZWJ?p=preview

Example usage:

$("#print").printThis();

$("#print").on("complete.printThis", function() {
    alert("Print complete")
});

@jasonday
Copy link
Owner

Won't merge with 1.x.

The browser stops all processing/rendering when the print dialog is open and restarts when the print dialog is closed. With this pull request, the complete.printThis is not actually executing because it is tied to an event, it is merely in the "queue" when the browser is again active. Because it is arbitrary without specificity, I have not merged this code. However, I have left the pull request open for informative purposes, because for many users this complete event (arbitrary or not) may be useful.

@oculus42
Copy link
Collaborator

oculus42 commented Jul 16, 2018

While it's not an event, 1.14.0 has added support for functions including an afterPrint function.

@Gennady-G
Copy link

Gennady-G commented Oct 25, 2019

Thank You @oculus42 for this info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants