As many of the posts here are tutorials, I thought it would be useful for readers to print off individual blog posts for future reference. Sure, it would be possible for a reader to choose the "print" option from their web browser window, but this would have printed the header, sidebars and other irrelevant sections of the blog, wasting paper and ink and time.
Using a combination of CSS and JavaScript, I've developed a simple yet effective method of printing only the blog post (and comments) from each blog page.
In this post, I'll explain how you can also add effective print functionality to your Blogger posts in just two simple steps.
To get an idea of what this post would appear like when printed, use the "Print Preview" function in your web browser. Whereas the current page appears colorful and includes the header, sidebars and other elements of this template, printed pages from this blog will appear like this instead:
As you can see in this example:
- The header and sidebar sections do not appear
- Text is black printed against a plain white background
- The post spans the width of the printed page
- The post retains images and formatting
- Only the necessary areas will be printed!
How to install effective printing format for your Blogger posts
Although it took me a few attempts to ensure my posts would print in this way, I have created this tutorial to make it simple and fast for you to install in your own blogs.
There are only two steps to add this functionality to your own Blogger template:
- Add a few lines of CSS code (to make printed pages appear in this way)
- Add one line of JavaScript beneath your posts (which creates a link for readers to print the post)
There are a few different options for the style of the print link, as I'll explain below.
Add CSS Style Code to your Blogger Template
To add the print styling code to your Blogger template, simply go to Layout>Edit HTML in your Blogger dashboard, and search for the closing </head> tag.
Immedietly before this line, add the following lines of code (copy and paste this directly to your Blogger template):
<style media='print' type='text/css'>
#header-wrapper, #header, .header, #sidebar-wrapper, .sidebar, #footer-wrapper, #footer, .date-header, .post-meta-data, .comment-link, .comment-footer, #blog-pager, #backlinks-container, #navbar-section, .subscribe_notice, .noprint {display: none;}
#main-wrapper {width: 95%}
</style>
If you like, you can preview your blog before saving. On this preview page, you'll be able to see the print preview displays only your blog posts (not the sidebar or other unwanted areas).
Finally, save your template.
Add a "Print this post" link
To notify your readers that your posts can be printed effectively, you'll probably want to add a "Print" link beneath each of your Blogger posts.
I've created three different styles for the print link, so you can choose the option which works best for your overall design.
To add the print link, go to the "Edit HTML" page again, and this time ensure that you've ticked the "expand widget templates" box.
Now search for this line:
<p><data:post.body/></p>Immediately after this line, paste one of these three sections of code:
For a simple text link:
<b:if cond='data:blog.pageType == "item"'>
<a href='javascript:window.print()'>Print this post</a>
</b:if>For a button link
<b:if cond='data:blog.pageType == "item"'>
<form>
<input type="button" value="Print This Page" onClick="window.print()" />
</form>
</b:if>For a snazzy link with printer icon
<b:if cond='data:blog.pageType == "item"'>
<span style='background: url(http://bloggerbuster.com/images/print.gif) left no-repeat; padding-left: 20px;'><a href='javascript:window.print()'>Print this post</a></span>
</b:if>Once you have added this code, save your template. These links will only be visible on post pages (to enable visitors to print the full post and any comments which appear beneath the post), so visit one of your post pages to see the link in action.
You can see an example of the print link near the bottom of this post. If you click on this link, you will be prompted to print this entire post (and comments) using your default printer.
Why it may be useful to enable printing for your Blogger posts
If you publish tutorials or lengthy content, your readers may benefit greatly from being able to print and read your posts offline.
Using the methods outlined here, readers can print only the content of your posts, and not the unnecessary distractions of the sidebar, footer and header sections (which saves on paper and printer ink too!).
You may also want to print off your blog posts for your own benefit, such as to back up your posts in print format, or to demonstrate your abilities in a print portfolio.
Unlike other plugins I have come across, this method also allows you to print any comments under your post too. Comments can add a great deal of value to blog posts, and may contain reader insights which are not included in the body of the post itself.
I hope this tutorial has been useful for you! Please feel free to print this off for future reference ;) and as always your comments are most welcomed.




109 Comments:
you did it again!!
I have many prints from this blog !!!
now it will be more easier :D
ops... I´m Davmig
forget to change my account :S
Thanks yet again Amanda! I'm going to keep an archive on hard copy.
Only at the moment the post is printed on two pages, with the first one empty, but for the blogger top line with search blog, flag blog etc.
You don't have that above your blog anymore, so that may be the reason it doesn't appear on your prints.
Is there a way to avoid this?
Otherwise splendid!
Thanks for Amanda. I have been looking for this tips to print a post, but from your tips I just can do to my blog successfully.
Thanks, Amanda. I'm toying with the first option only (no "Print This" link yet) as I have quite a heavy footer already with all the Feedflare stuff! Seems to work fine. Many thanks.
hello this is again me . please one more question, i was using vista button for for creating buttons for my blog .
but when i saved it , it gives a html file with a folder containing a javascript file and images of tabs .
can you please tell me how to use them on the blog.
Dear Amanda , thanks so much for this , I needed for long , now I got some questions to you
how I can the print link appears with in the same line like posted by , edit ,icon , sent a message etc ??
This one
Number two
how can I have only the printer icon as a link ??
number three
is there a way to change to change the printer icon in the CSS area away from the script ??
sorry if I asked too much but I wanted this feature from long time and i could not believe myself that it could be made in blogger.com
hey Amanada ,sorry for so many questions , pardon me but I real admire your blog and I was wondering how you made the twitter updates look this in your header , I would like to put the twitteriffic blue bird in my twitter widget but I do not know how ??
That was something I was trying to do way, way ago, but you're helping came just in hand. Much appreciated Amanda, see it live in our Education & Tech.
Hi Amanda, it's me again. Thanks, your tips and tricks for printing post effectively have done on my blog. But, I'd like to ask you 2 questions, may you give me more tips and tricks or suggests (1) how to print post, only the text and/or image in the post, and (2) when we click the print button we can see the preview first before print the post. Thanks before.
Thanks for a great tip - very easy to do compared with some solutions I was looking into!
One question: I don't want to print the comments on my posts - what should I change to stop them being printed?
Thank you!
Thanks for the great tools for us bloggers. This is something I've wanted for a Looong time and it looks almost perfect but maybe I'm just doing something wrong. I've installed the print button on posts but it cuts off the right side of the screen... even the print button on your blog. It cuts off the right side of the text. I've changed the marhins in the page setup, I've even switched to landscape, changed to 95% value in your code higher and lower. Nothing seems to make it print the whole post left to right. I'm thinking maybe there's a flaw in the javascript? Do you have any thoughts? I've LOVE for this to work perfectly. The site I'm building for your reference is: http:www.stevemounts.com Thanks!
Been wondering if you have anyway to do this for old school Blogger templates.
Thanks for the idea.
Thanks, good information.
अच्छी सूचना है।
Hi Amanda,
I'm desperate ! Your tips doesn't function on my blog.
Please, tell me why ?
I see the button print but doesn't print nothing !
Thank You for help !
Antonio
http://bergamo2000.blogspot.com
Hi Amanda:
I've been looking for something like this for a long while. I followed the steps and added it to my blog Jordan's View, but the "print this" is only appearing on some older posts and not on recent ones.
I know I have quite a few widgets and additions on my blog template, could this be interfering with your add-on?
I really want to use this. Can you help? Thanks!
Hello Amanda! Thanks for your good initiative: I have a lot of print requests and I was/am getting desperate: your button doesn't work! I keep on having the same problems: the print example or printed page contains a first page with text that continues after the pages ends, but not on the second page - so, no print. Have you heard this problem before? Could you maybe help? I have a (professional) blog, www.theory-talks.org.
I would be very much helped with some suggestions...
Many thanks!
Best,
Peer
p.schouten@theory-talks.org
For some reason, when I went to print, I still saw the header and everything else. Does it make a difference what template you start with?
Amanda
I was looking for a print code like this, I was using a code that printed the whole page. You've just saved my life :o)
Hi Amanda
Many thanks for all your hard work, I've found much of it really useful. Re "Print This Post, though, I'm only able to print page 1 of any post; subsequent pages come out blank except for the header info. Am I missing something?
Ken Head, I noticed the same thing. But only in Firefox.
If I view my blog in IE7, I can print all pages of a post. But in Firefox, only the first page prints.
I haven't yet figured out why this is, but if I do, I'll post my solution here.
Hi C. August and many thanks for the tip. I've been struggling with this in Firefox all day and wasting paper as well as time. I tried Safari, too, but had the same result. However, I'll give IE a whirl and see what happens. It'll be interesting if IE proves more useful than Firefox! Like you, I'll post here if I get a result.
OK, I solved it!
This is a bug in Firefox, where it can't print a DIV or a Table that spans multiple pages. This happens whether or not you use Amanda's print CSS code. It's just more obvious when you try to print just the body of a post.
IE7 works fine.
The fix is to edit the following line of CSS code, adding the "overflow" bit:
#main-wrapper {width: 95%; overflow: visible !important;}
@C. August:
Thank you so much for this tip! I've just been reading your comments on this post and realized that my own blog won't print properly with this new template!
Hopefully your trick will help solve all our problems :)
I will update this post shortly with your helpful information!
Best wishes,
Amanda
Hi again C. August
You're clearly the genius of the group. The advice worked immaculately and I've printed in a couple of hours what I hadn't managed in a couple of days - without wasting a single sheet of paper, too! I don't know where your fix for Firefox came from, but I'll give that a try too.
Very many thanks!
Ken Head
Gracias. Ha funcionado, aunque me gustaría decirte un par de cosas: Para que no se imprima la navbar hay que añadir .navbar a las cosas que no van a imprimirse y si quien copia este código tiene dos sidebars y/o el crosscol activado, y/o elementos en el main, también ha de añadirlos a la lista, así como #comments, para que no se impriman los comentarios y .post-footer, para que tampoco se imprima.
De todas formas, gracias por la entrada. Lamento no conocer tu idioma para poder dejarte este mensaje, pero espero que lo comprendas.
Un abrazo.
Good stuff easy to add in and no issues with printing !! Awesome!
I have been working on this for hours. I put the codes in the right places and not one thing shows up on my blog. Help!
It is such a neat idea and I am so bummed. I'm not good at HTML but I usually can paste things in and have then work. What dumb thing am I missing here?
Your post will be suitable for those templates that used IDs (mentioned in your css).
THANK YOU ! elegant and clean and easy to use.
Amanda, i've installed this hack on my blog, but is not working right. It is only printing the first page on paper (or PDF)... I've tested here in BloggerBuster and have the same problem too...
[]'s
Compulsivo
Ooops.... The problem only happens in Firefox. IE7 is printing fine...
[]'s
Compulsivo
thank you very much!
also.. dont forget to add #Adsense1, #Adsense2, etc to your header code to exclude your ads from printing. I noticed some of the adsense ads were messing with printing layout - so i removed them.
THANKS AGAIN!
This is a GREAT site! Thanks for the great printing utility. I also noticed that it is flawless with IE7, but doesn't seem to capture the whole post when using Firefox. Any way for me to work thought that (I use Firefox about 95% of the time). Thanks again for all the great tips and information...you just made my wife's blogging experience that much better!
I was really enthused about this post, but I messed around for an hour or so and didn't get the job done. I ran into 2 issues.
1) I never got the print icon to show up. I could get comments to show up before and after where the print icon should have been, but no icon.
2) While it was nice to just a single blog entry print, I still got over 20 blank pages.
I ended up having alot more success embedding the HP print capability. Although I am not excited about the advertisement, a window popup allows me the posts and comments I want to print and the output is beautiful:
http://developer.tabblo.com/index.php/hp-blog-printing/
I didn't want the comments to print or the Subscribe to link at the bottom so I added,
#comments and .feed-links to hide them from the print.
I still haven't been able to get it to work in Firefox. I only get a blank page. So if anyone has a work around, that would be fantastic!!
hey, I love this blog - i will try and keep up with it!! please keep more coming :)I wish I could start a blog but I don’t have much time. I consider your advice as very valuable.Really Great. :( Thanks,
Thanks for this Amanda, but I have little problem: the printer only prints one page and the second always comes empty. Why is this happening and how can I fix it?
For the moment I had to take this option off my blog because of this issue, but I hope I can fix it in some way.
Thank you!
Razvan Dobre
Amanda,
Thanks so much for your brilliant tip. The printer-friendly page works well in Windows, but Firefox 3 on the mac still prints part of the background. Any ideas how to fix that?
Keep up the good work on the tips!
David
Amanda, I really need your help with this. I've cut/pasted both items where you instructed. It was very difficult finding the pdata.post etc.. line but after an hour of hunting, I found it. None of it seems to work. I don't see the print option appear after the posts. Is there a way I could speak with you. I'm not a computer wiz but really want to make this print option thing work on my recipe blog. http://BeABalaboosta.com
Thanks so much. Write to me at thebalaboosta@gmail.com and I'll send you my phone number. Please, I beg of you.
Hi, It's me again... I finally got to where I can see the print button and I printed, however, the posts print with the text material that comes before all posts, and, the stuff that comes after. How can I exclude the pre post text from the printed post?
Thank you ! Very useful !
I followed the directions and it works for the most part, but for some reason only the first page will print properly and all other pages just show up as blank. Any idea how to remedy this? Thanks!
Thank you so much. I find this code for a long time ago.
Hi, I've added the html so this works in firefox but all the comments print too.. Is there anything I can add so that comments are not printed?
I just tried this in IE7, and it prints all but the first page, which is blank.
I tried implementing this, but I don't want to print out whatever comes after the "Print This Post".
I would appreciate it if you could tell me what to do for this. It would save me a lot of trouble as I have lot of recipes on my blog.
Thank you very much for this post.
Thank you so much! I'm trying to print almost a year's worth of posts for my Gram who isn't very computer savvy. This will save me bucket loads of ink.
Cheers!
Becky
Hello, this is awesome if I can get it to work...When I go to install the icon, my piece of code doesn't close with that tag. I tried inserting it after the close that is there and nothing shows up :( Any ideas?
The particular blog I'm trying this on isn't a Minima template it's "Rounders" if that makes a difference
THANK YOU FOR YOUR BRILLIANT TIP...ONE THAT I LOOKED FOR QUITE SOMETIMES, AND ITS JUST WORKING AS I WANTED. THANK YOU VERY MUCH.
I added the code and it looks good in preview mode, other than the first page containing only the top bar and nothing else and the second page being all that it will show. What about a third page? The post I wanted to print is longer than one page. Will this not work for posts that are more than one page?
Thanks Amanda, I was able to install the print button quite easily.
1. I would like to know if there is a way to eliminate the images and print only text?
2. I would like to eliminate the comments and backlinks. I tried adding the code Ashley suggested above but I couldn't get it to work.
Do you have any suggestions for me. Thanks again.
Thanks for the wonderful tip. Is there any way to take out the internet information ie. website address and time printed and the search blog box. It would be perfect if I could get ride of those parts! This is a great way to save all my journaling - thank you! Please let me know!
Ok I figured out how to eliminate the internet info. It is the "Nav Bar" that I don't want to print. How do I do this?
I can't find the p data post body p line. (Left out dots, etc. here because cannot trans. same.
Unable then to create a print button. Anyone?
Hey Amanda,
Just came across your site, and it worked immediately. Thanks for the code. I was wondering if there was a way to include a button (or link) at the bottom of the posts on the main page, so that a reader could print the specific post only from the main page?
Thanks!
Like Tom Paine above I also can't find the p data line. Has Blogger perhaps changed their template since this was written?
Amanda,
Thanks for the code. I've been looking for a neater way to print my blog.
I put in both fixes. I still have one problem though - if a post is longer than one page, it only prints the first page although it spits out the rest of the pages with nothing on them. Any ideas? (It also did this with the sidebar format before I put your fixes in)
Thanks, Bob
Hi Amanda,
Thanks for the code. I've been looking for a neat way to print my blog off. I did find that Firefox does not work well for printing blogs as it will only print one page. I had to revert to Internet Explorer to get all pages of a post printed off - with or without your widgets.
Thanks, Bob
Hi Amanda,
Thanks for the widget codes. I've been looking for a neat way to print my blog off.
I did find that Mozilla Firefox does not work well for printing off blogs as only one page of a post will print. I had to revert to Internet Explorer to print properly - with or without your widgets.
Thanks, Bob
Bloody brilliant! I print out my poems for my mother and it is great not to have to print all the headers and junk each time. Thank you!
Thanks, amanda, this info use full
Yet another flawless and a really well explained tip for my blog, which help me loads. Thanks a ton Amanda. Keep up the great work and continue helping us novices to the world of HTML to improve our blogs, one tip at a time ;)
Hey Amanda,
Wanted to say that your blog is so helpful!
I was wondering how do I do this in the old blogger??
Thanks
thanks for amazing code:D
I want to make a exporting of a post in .doc or/and in .pdf format.
Hi Amanda,
Thank you for this post! I was able to do the first part, but not the second. I'm not finding the "data post body". I tried pasting near something similar, but it didn't work. Any suggestions? Thank you!
thx
I found it and got it to work. Thank you Amanda!!!
Thank you very much, man! This results very well for my blog. It`s a nice function!!+
Greetings from Venezuela...
Thank you very much! Greetings from Venezuela, this results very well for my blog. It`s a nice function.
hm nice post :D
http://trik-tipsblog.blogspot.com
I can't find my html line for the print code that starts with ....
Can someone tell me where to look???
Thank-you, Lynette
Hi Amanda. I love this fix, however even after adding the overflow bit that C. August came up with, only one page prints in Firefox. (On your blog as well) Any chance of updating this so it will work? Thanks!
Removing the "overflow:hidden" under "#main-wrapper" lets me print out more than one page of a Blogger blog in Firefox. (I leave "overflow:hidden" in place for "#sidebar-wrapper" which I have set to disappear from printing anyway). The "overflow:hidden" is "fix for long text breaking sidebar float in IE" according to a comment next to it.
Even better: Instead of removing "overflow:hidden" from under "#main-wrapper",
leave it there, but
under your section
style media='print' type='text/css'
where you already have
#main-wrapper {width: 95%}
make it:
#main-wrapper {width: 95%; overflow: visible;}
Hi
thnx for this tutorial,i'm a beginner & i have a problem when i click on 'print this post' i get all the blog printed (sidebars in one page), logo in another page, post in another page too
so is it cause in my template used different words for ex: #sidebar-wrapper in my template i have #sidebar1-wrapper,,please help me
I really appreciate your tutorials, Amanda. They have been extremely helpful to me.
Still not working with Firefox, I've tried all your fixes. It works 100% on Safari and I'm awaiting feedback on IE
On all browsers the text is coming out as a long column rather than a paragraph. Help?
Blog in Question Thoughts?
Amanda, thank you!
Anyone checking the comments and helping?
Hello, love this and it really has helped some troubled users. My only concern is that my right rail items ads, widgets, etc still are appearing on print preview and print out. How do I remove those two columns in print mode? Thanks!
Carlisle Daily
carlisledaily.com
Thanks for such a useful post. I was looking for such information.
Well, I don't get it.
I know I did EXACTLY as described here.
Stumbled at Find "data:post.body".
This code just is NOwhere in the default template.
I know I'm too late to the party but needed to vent.
Hi Eikelein!
First you Check "Expand Widget Templates"
Then you find this code, you will get it
Regards,
Babu A
http://blog-mstechnology.blogspot.com/
Thanks Amanda!
Regards,
Babu A
http://blog-mstechnology.blogspot.com/
I use 3-column template, not the blogger default 2-column. Your code doesn't seem to work for my template. I have narrower right column and left column, and the middle column is the post. Can you help?
Thank you so much!
And also C.August in the comments.
At least I'm able to print out properly my own blog.
I want to print ALL my posts out to one file -- without the paraphernalia, and without the dates, with a page break forced at the end of each posting. Is there a way to do this? Or even better, import all of them into Word without the extra stuff?
Found you on Google...
thanks for the tip, but any additional tips on how to print post without comments?
Thanks
Jennifer
it did print the post but it printed only up to 3/4 of the post. I'll try to find ways to get around it. Thanks for the tip
my print starts at the middle of the paper. I followed Cs advice. Any ideas?
This is great thanks, just found this by accident. It's working well, but does anyone know how to stop my photos splitting across a page?
Jade
Thank you for this! Yours has been the only instructions that told me to put the code AFTER the data:post.body line - the rest have said to replace it - no wonder it never worked!
Thank you so much. I can now print off our family blog to keep as a record. The only thing I can't do is print posts longer than one page as the second page doesn't show up. How do I fix this? Also I can't read the answers to the above questions. How do I do that. Thank you. Tara
Valeu!Uma dica importantíssima para dar uma "cara" mais profissional para blogs.
Muito bom mesmo! Abraços,
Antonio.
Amanda,
This solution works well in Firefox, but only works in IE versions 7 and below. For some reason, IE8 does not format properly.
Any ideas? Can you update the post with a fix for IE8?
Implemented on my blog: http://www.drugchannels.net
Thanks,
Adam
@Tara It works for you in IE but not Firefox --- which needs the overflow setting. Try this, replace:
#main-wrapper {width: 95%} with the following statement covering your main and content wrappers to be safe:
#main-wrapper, content-wrapper {width:95%; overflow:visible !important; float:none; border:0px; margin:0px; padding:0px;}
I have more detailed explanations on my blog, but this should work for you.
FYI, SBA helped me implement this solution and fix an IE8 problem with Amanda's approach. You should check out his post: http://bpwebnews.blogspot.com/2009/08/how-to-create-print-this-post-button-on.html
Adam
this is really very important.. for printing.
a lot of websited print their pages with a lot of ads can i go around from this ??
thanks in advance
My Blog
Amanda, Why don't you answer people's desperate pleas for help once in awhile.
At least someone was listening and answering: http://bpwebnews.blogspot.com/2009/08/how-to-create-print-this-post-button-on.html
Or maybe put this very last post by Adam J. Fein at the very top of comments so the rest of us don't have to read through a hundred comments before we finally get the solution. A little consideration for our time, please.
Hi Amanda,
thanks for the post, but for some reason, the print function still keeps the sidebar in the printed version. Can you think of a reason why this is happening?
Great idea. Thank you : )
Liz
x
this is wonderful except i don't have the second set of coding in my blogger html, even when i ticked expanded widgets. hmmmm
Printing is an essential part of publishing. Offset printing is best opted by businesses as it can give high image quality. We all are interested to get printing at discount rate and good quality. Before choosing a printer, assess the sample printed stuffs by them for ensuring quality.
Hi there,
You post was really great but I failed ti implement it as noprint tag keeps bugging me. So I googled and came up with a new way of doing it without editing the templete. It works as a gadget. The link to the codes and instructions are here http://blog.sumitcbrty.com/2010/04/widgetcode-for-printing-printer.html OR click on my name in this comment ti view the page. Hope you would give some feedbacks on it.
BTW I have linked this post to my post.
Thanks! After a little bit of tinkering I got it. I searched in the code for and inserted the button code after it (there were no p's to be found, however).
Post a Comment