Buttons icon indicating copy to clipboard operation
Buttons copied to clipboard

Use iframe for print instead of popup

Open FrancYescO opened this issue 6 years ago • 4 comments

Based on jquery PrintArea plugin that i've found http://demos.codexworld.com/print-specific-area-of-web-page-using-jquery/jquery.PrintArea.js

i've reworked the print workflow to dinamically generate an iframe instead of using a new tab (popup) for print that will cause some bug like: -parent tab looks like freezed if you don't close the print tab (popup) -randomly the setTimeout will not work causing the print view to not open

The code is fully working but basically i'm doing this PR as an idea as the code should be cleaned and probably better tested for crossbrowser compatibility

PS. sorry for the changes view but my IDE destroyed the formatting/ident

FrancYescO avatar Mar 14 '18 11:03 FrancYescO

Interesting one - thanks for suggesting this. I hadn't considered using an iframe and printing from that before. I like the new tab because it shows you want is going to be printed before it gets printed, but I suppose a modal could do that with an iframe. Let me solicitate feedback on this one.

DataTables avatar Mar 14 '18 11:03 DataTables

at least with Chrome the UX of opening a newtab result in a very bad experience as the content of the new tab is never showed to the user but will be instantly hovered by the print modal of the browser (that personally i consider enough for preview).. yeah is still a little tricky if you want to check the print DOM but it can still be done :)

FrancYescO avatar Mar 14 '18 11:03 FrancYescO

@DataTables are you still interested in this?

FrancYescO avatar Jan 26 '19 16:01 FrancYescO

I haven't really had any other feedback on changing the current print view or suggesting that its UX is a bit dodgy. I wonder if one way to address the point you make about the print dialogue being shown immediately would be to introduce a delay with a message on screen saying what is happening and then show the print window. Or just disable the auto print option (which is already available)?

DataTables avatar Jan 26 '19 21:01 DataTables

Going to close this one off - there hasn't been any other feedback about the UX of the new window / tab, so I'm okay with it how it is.

AllanJard avatar Oct 17 '23 14:10 AllanJard

if one way to address the point you make about the print dialogue being shown immediately would be to introduce a delay with a message on screen saying what is happening and then show the print window.

btw maybe its possible, but if you add for example a gif or a css that show some loading animation, at least in my case building a "complex" print the current tab will look just freezed and you cannot interact with the DOM, and the setTimeout looks unreliable

FrancYescO avatar Oct 17 '23 15:10 FrancYescO

Are you able to give me a link to an example of a "frozen" page like that? I'm not seeing that here.

AllanJard avatar Oct 17 '23 18:10 AllanJard