Skip to main content

Add Print as PDF Button in Your Blog!



Save as PDF Button


Sometimes your blog or website reader may wanna save the post as PDF. Or they may want to print it. And there are many free tools to add Save as PDF button. But the problem is that, most of the free tools doesn't allow you to remove the background images of your site. I mean this is not print friendly. As a result whole web page is saved. And this is very irritating. 

Today I'm sharing a code that is free from this problem. It allows you to save only the text with related image. Let's try this- 
  1. Sign in into your blog. Then go to design.
  2. From the left panel, hit on the Layout button.
  3. Now click on Add a Gadget.
  4. Choose HTML/ JavaScript.
  5. Now copy and paste the following code into the Content Box.
  6. Save the gadget and view your blog to see the change! 
<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><script type="text/javascript">document.doAT = function(cl){var myclass = new RegExp("hentry");var myTitleContainer = new RegExp("post-title");var myPostContent = new RegExp("post-footer");var elem = this.getElementsByTagName("div");for (var i = 0; i < elem.length; i++){var classes = elem[i].className;if (myclass.test(classes)){var container = elem[i];for (var b = 0; b < container.childNodes.length; b++){var item = container.childNodes[b].className;if (myTitleContainer.test(item)){var link = container.childNodes[b].getElementsByTagName("a");if (typeof(link[0]) != "undefined"){var url = link[0].href;var index_page = true;}else{var url = document.url;var index_page = false;}if (typeof(url) == "undefined"|| url == "undefined" ){url = window.location.href;var index_page = false;}}if (myPostContent.test(item)){var footer = container.childNodes[b];}}var n = document.createElement("div");if (index_page == true) {var at = '<a href=' + url + '?pfstyle=wp' + ' style="float:right; margin-right: 1em; color:#6D9F00; text-decoration:none;" class="printfriendly" title="Printer Friendly and PDF"><img style="border:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a>';}else {var at = '<a href="http://www.printfriendly.com" style="float:right; margin-right: 1em; color:#6D9F00; text-decoration:none;" class="printfriendly" onclick="window.print(); return false;" title="Printer Friendly and PDF"><img style="border:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a>';}n.innerHTML = at;var origFooter = footer.innerHTML;footer.innerHTML = n.innerHTML + origFooter;footer.style.overflow = "hidden";}}return true;};document.doAT("hentry");</script>


If you wanna place the button at the left side then replace the red colored words as- float:left. And if you are expert in coding like html, CSS, then you can easily place this code anywhere you want. 


Code for other Websites Other than Blogger: 
<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="http://www.printfriendly.com" style=" color:#6D9F00; text-decoration:none;" class="printfriendly" onclick="window.print(); return false;" title="Printer Friendly and PDF"><img style="border:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a>

Print Friendly and PDF

Stay with Marks PC Solution to get more interesting IT topics!

Comments

  1. Replies
    1. Thanks for your comment. Stay with Marks PC Solution to get more nice tips . . .

      Delete
  2. Excellent tips. i am also looking to add this pdf button in my site

    ReplyDelete
    Replies
    1. Marks PC Solution always try to gather knowledge for you. Whenever u face any problem just contact us from the option at the right side bar.

      Thanks for staying us.

      Delete
  3. Replies
    1. Wht is your site? Have you completed the process properly?

      Delete

Post a Comment

Popular posts from this blog

GTA San Andreas Cheat Code (PDF)

After Vice City, San Andreas is the most popular game released by Grand Theft Auto (GTA). Usually GTA releases role playing game. San Andreas is such a game where you can act like a person. You can do everything. You have to take part in missions and complete them.  To make your missions easier, there are lots of cheat codes. If you can properly apply these codes, the tough parts of the game will be easier. Cheat codes are somewhat like keyboard shortcuts of computer programs.  I've shared 63 cheat codes below. There were more cheat codes in my collection, but I've omitted the less important cheats. Effects or result of the cheats are on the left side, and the codes are on the right side.  You can copy the following codes in your PC. And for your convenience, I've also uploaded a PDF file of these codes. You will find the download link at the bottom.  Effect Cheat Code Adrenaline Mode MUNASEF All Cars Explode ALL...

How to Change IP Address on Windows 10 (Easy Way)

    In fact this is not a very difficult task. But in case of emergency you may not find the right option and this happened in my office few days ago! I solved the problem myself and decided to write a note for you at my site . . .   Changing IP Address on Windows 10 Simply move your mouse pointer at the bottom right corner and make a click on network icon > choose Open Network and Internet settings. Follow the image below -    After clicking on this option you will get the following dialogue box. Here you should notice Ethernet properties. Click on it.   Now you will get another screen as below. Here you will get several options. But our concern is IP settings and Properties . If wanna view your IP details then look at the Properties. If you need to change it then hit on the Edit button.    After clicking on the Edit button you will have two options i.e. Automatic (DHCP) & Manual.    In order the change the IP you should choose ...

Office 2016 Activator (KMSPico 10.1.5)

It's been couple of months after the release of final version of Microsoft Office 2016. And maybe you're tired of finding for a working activator for this version. Today I'm gonna share Office 2016 activator with you - no more waiting!! About the Activator   Name: KMSPico 10.1.5 File Size: 3 MB (Approx) File Type: Zipped Folder 100% Neat & Clean - No virus! Activating Capacity . . . KMSPico 10.1.5 is successfully leading the KMS world for last few months. If everything is okay, success rate is 100%. This tool has been tested and verified by Marks PC Solution. With this tool, you can activate -  Office 2016, 2013 & 2010 Windows 10, 8.1 & 8 Hopefully this version will work for both 32 bit & 64 bit versions of Windows. Installing Office 2016 Collect/ Download Office 2016 Professional Plus from Microsoft or somewhere else. Install it as trial version without any key. Use the follow...