?
Solved

Can you print to a client's default printer from an ASP.NET page

Posted on 2006-11-14
4
Medium Priority
?
411 Views
Last Modified: 2010-07-27
Hi !

I need to print to a client's default printer from an ASP.NET page?
The content is either pdf or html.

How can I do this. Any code samples will be great.

Thanks
H
0
Comment
Question by:countrymeister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 31

Expert Comment

by:alorentz
ID: 17939576
You would do it in Javascript is anything.  First 2 links have code:
http://www.google.com/search?hl=en&q=default+printer+JAvascript&btnG=Google+Search 
0
 
LVL 1

Author Comment

by:countrymeister
ID: 17957493
How do I attach the pdf or html file to the content to print?
0
 
LVL 31

Accepted Solution

by:
alorentz earned 1500 total points
ID: 17957589
You can't with PDF (they need to do that themselves), and for HTML...you put the Javascript in the HTML body onload event. "window.print()"
0
 
LVL 1

Author Comment

by:countrymeister
ID: 17957922
Well from what I read from the posts on this site, there is a concept to print an iframe, and attaching a pdf file as src( ihave added the snippet below).
This would bring up the print dialog on the client.
I have to agree with you on the initial question and award you the points. I will post another question on how to attach a pdf file as src to a iframe and invoke the print script from code behind.


<script type="text/javascript">
          function zPrint(oTgt)
          {
               oTgt.focus();
               oTgt.print();
          }
     </script>

<iframe id="myIFrame" style="width:0px;height:0px" src="some.pdf"></iframe>
<input type="button" value="Print PDF" onclick="zPrint(myIFrame);" />
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question