Print repeating Page headers in Chrome [closed]

Ok, no takers on this one, so with a few more days of looking around and choosing not to write my own solution, here is what I found.

At the very bottom of a Stack post with no votes and no comments was this lonely little link: http://welcome.totheinter.net/columnizer-jquery-plugin/#comment-53243

This thing is awesome, it’s designed to handle wide pages of content and format them into columns like a newspaper. It handles page breaks especially well and is quite flexible.

In my case, I needed a single column (width of the page) and repeating headers and footers. I used Example 10 as my base:http://welcome.totheinter.net/autocolumn/sample10.html

I simply added the link to the plug in, changed the necessary IDs and classes to suit my page, and made some minor CSS changes to heights and widths and I was able to print multi-page content with repeating headers and footers in Google Chrome! (my company’s preferred browser)

TIPS:

  • One little CSS trick, I made the content div MIN-HEIGHT set so it
    pushed the footer down on short pages. (Don’t do this if you want the user to have the option of portrait or landscape). My final print is fixed so this was great for me.

  • I tested different heights on content to see how it breaks the content, it was smooth everytime.

I did try to post my final example in JsBin and Fiddle, but it ran an error each time.

So again, Example 10 above is a great place to start as it shows before and after.

Here is my final with variable height content and repeating Headers and Footers:
(this is the view when I click the browser Print Link/Button in Chrome )
enter image description here

UPDATE 7/2014: Once again Chrome is the bane of my existence with print issues. I saw the comment below about the link that I provided. He’s right, it renders correctly but the print view is incorrect. Sorry about that, but it’s still a good example to play with to learn the settings.

I am still using this solution, IT DOES work, but you have to adjust the CSS and the JS var for body content size. The sizing combinations are VERY Sensitive, but when you get the page height/width right and the content size right, it does work. I had to write separate functions for paper sizes legal/letter. It’s limited but works for our purposes.

I also noticed that depending on my window size it did not not always look right, but the final PRINTED product was as expected with repeating headers and footers, so I used a window that went straight to print so the user didn’t notice the output, but rather saw the chrome print rendering. I hate these types of workaround but with everyone in my office using Chrome, it’s a necessary evil.

Leave a Comment