Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Print only image of a web page

I have a 650px X 1000px photo on a website page. There is a button below the photo.

How can I print the photo only except the full page. I want to save it as PDF or print only the image. Not save as image.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  1. Open new window using window.open.

  2. Write to it the img tag.

  3. Once the image was loaded, print the document using window.print().

  4. Close the window using window.close()

You can do this with code like this:

Script

    function printImg(url) {
  var win = window.open('');
  win.document.write('<img src="' + url + '" onload="window.print();window.close()" />');
  win.focus();
}

Index.html

    <img src="http://i.stack.imgur.com/hCYTd.jpg" />
<button onclick="printImg('http://i.stack.imgur.com/hCYTd.jpg')">Print</button>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!