Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Printing Image in asp dot net

Printing Image in asp dot net

Scheduled Pinned Locked Moved ASP.NET
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tufail Ahmad
    wrote on last edited by
    #1

    I have image control on my asp.dot page, i want to print that image. how can i do it? help please

    S 1 Reply Last reply
    0
    • T Tufail Ahmad

      I have image control on my asp.dot page, i want to print that image. how can i do it? help please

      S Offline
      S Offline
      Sandesh M Patil
      wrote on last edited by
      #2

      You know 'window.print()' function will print the HTML content of the current page in the browser window. Put the image in a DIV tag and then use the following code. The content of the DIV is written to a new window and then printed in this code.,

      <script type="text/javascript">
      function ClientSidePrint(idDiv)
      {
      var w = 600;
      var h = 400;
      var l = (window.screen.availWidth - w)/2;
      var t = (window.screen.availHeight - h)/2; var sOption="toolbar=no,location=no,directories=no,menubar=no,
      scrollbars=yes,width=" + w + ",height=" + h + ",left=" + l + ",top="+t;
      // Get the HTML content of the div
      var sDivText = window.document.getElementById(idDiv).innerHTML;
      // Open a new window
      var objWindow = window.open("", "Print", sOption);
      // Write the div element to the window
      objWindow.document.write(sDivText);
      objWindow.document.close();
      // Print the window
      objWindow.print();
      // Close the window
      objWindow.close(); }
      </script>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups