How to have multiple css print layouts on a single page application?

Tags: javascript,html,css,single-page-application,printing-web-page

Problem :

I have a single page application, and I have different sections where I want to print out list of images each on it's own page.

I thought maybe to use iframe for this purpose, but I wanted to have an answer from someone experienced with this situation.

What is the best way to approach this problem?

Solution :

You can use CSS media queries to direct CSS rules at print time as described in this answer: How do I hide an element when printing a web page?.

You can then set different classes on some high level part object before printing to control which CSS rules apply and thus what gets printed in a given operation.

You can also have a whole stylesheet withe the media type set to print so it applies only when printing.

Or, depending upon the specific situation, you can open a new window, put the content to be printed in that new window and print that window. Usually, it's better to avoid opening a new window if you don't have to.

    CSS Howto..

    How can I get IE8 to accept a css :before tag?

    How to add styling (CSS) to tags in Javascript/Jquery

    How to apply custom css to split post into multiple page

    How to line up lists side by side?

    How to add padding to the cells of a table with CSS [closed]

    how to change text color hover

    How to php echo content into
    classes dynamicaly [closed]

    How Should I Send HTML/CSS Content To A Server?

    How to get a background image to print using css?

    CSS How To: Easily make all rules check for 1 ancestor

    How to run a Javascript function on an iframe before the source (src) is loaded?

    show html element before sending ajax sync request

    How do I set the height of an iframe with the min-height property in the body?

    How to cut off text that is longer than the space available and show '…'?

    How to stop the latter part of javascript from being called?

    How to make a box's content overflow past background

    How to fix CSS wide layout issue?

    on hover and on click how to fade out image and fade in content text

    How to apply a css class to master page based on the url using jquery? [closed]

    How can I get the font size of an element as it was set by css

    Hide all div element but show first two

    How to make a slider with divs and variable width?

    How to prevent the loading of background image in each page?

    Showing an hidden element with an opacity-animation

    Responsive CSS: Replicating how Facebook's chat panel disappears below a certain browser window width

    How to serve different size SVG graphic in css background image?

    How to use google font

    How to override a 's CSS when loaded by ajax?

    How to make a navbar stay in one line?

    Force jQuery show/hide to respect display: table?