vijay shiyani
vijay shiyani

Reputation: 766

Image printing in asp.net MVC?

I am trying out asp.net mvc and i learned how to retrieve and display image from database.

this is how i am displaying image in browser with the help of HomeController and GetImage method which takes ID as parameter its works fine.

View code snippet

<img alt="DRS IMAGE" src="@Url.Action("GetImage", "Home", new { ID })" />

How would I provide print button in view the, so when I click on that button it prints out display image on browser?

Upvotes: 0

Views: 1855

Answers (2)

Mark Redman
Mark Redman

Reputation: 24515

If you are using jQuery there is a plugin called jqPrint which is good for sending contents of a div or other element to print, possibly a good solution.

Upvotes: 1

Oded
Oded

Reputation: 499092

You need to write a javascript function that will open a new window set to the image URL (as above).

Attach this function to the click event of a button and you are good to go.

Upvotes: 1

Related Questions