I need to be able to print a jQuery UI dialog. My solution thus far has led me to create a "Print" button that creates a new <iframe>
filled with the contents of the dialog and then prints it.
I'd like to be able to remove the <iframe>
as soon as the printing has completed. Is there any way I can do this? I know there is an onAfterPrint
event in IE, but I need this to work in all browsers.
Edit: I appreciate the alternative suggestions, however I ran into all kinds of problems trying to use CSS rules to print jQuery dialogs. On pages with a lot of content and multiple dialogs, the structure of the overlay and other elements would cause extra blank pages to be printed. I've tried many combinations of { visibility: hidden; }
and { display: non开发者_运维知识库e; }
but couldn't find a solution.
Have you considered making a special stylesheet with the media="print" attribute? Make this stylesheet hide everything else on the page that you don't want to print and reset any formatting as needed. (For example, reset the positioning on the box from absolute to static)
精彩评论