0

I have an html page with a link like this:

<a href="javascript:window.print()">Print QR code</a>

When a user clicks it, it does what you think it will.. prints the whole page.. sadly, it does not print the QR code at all. How do I specify what I want to print? Like, lets say I want to print a specific image on the page?

gdoron
  • 147,333
  • 58
  • 291
  • 367
AturSams
  • 7,568
  • 18
  • 64
  • 98

2 Answers2

2

I know this is an old post, but just wanted to share you this solution that worked very well without using jquery.

http://www.codescratcher.com/javascript/print-image-using-javascript/#comment-762

ricardo_escovar
  • 447
  • 4
  • 5
1

I found this plugin that does the trick:

http://projects.erikzaadi.com/jQueryPlugins/jQuery.printElement/

$('img#some_id').printElement();
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
AturSams
  • 7,568
  • 18
  • 64
  • 98
  • Ah cool saweet man will remove my post check this out: http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm **or** http://stackoverflow.com/questions/6674425/can-i-modify-this-javascript-to-print-images-from-div if need be – Tats_innit Jun 24 '12 at 08:05