I have a page from which the user will be able to print. However, the page which will get printed is not the one the user is viewing, but rather a new one I’d like to generate on the background and (possibly) only show the print dialog for it.
Just to make things clear:
- User is on “View.aspx” and clicks my Print button (not the browser’s one).
- The Print button loads the content of “Printable.aspx” and displays a print dialog for it while the user is still on “View.aspx“.
FYI, what I’m trying to avoid is to have the “Printable.aspx” open in a new window and then show its print dialog.
Thanks in advance.
Use a combination of MEDIA tags in CSS to show/hide objects for printing.
You can make controls that are style
Display:noneon media screen, so the user only sees them when printing.Any of your controls can be classed as “PrintOnly” so you only see them when printing. You just need to have the css class defined once for “@media screen” and once for “@media print” to ensure they behave differently.
You can also bring in an entire stylesheet for print-only.