Printing in ASP.Net (Client/Server side)

A

ap

Hi, It is a quick question...

Is that impossible to print the page(Web Form .aspx file) in client side
using GDI+ like

PrintDocument pd = new PrintDocument();
pd.print();

As I know it is a server side printing... and is that possible to make it
to client side printing or it must be printed using javascript??

Thank you so much

AP
 
P

Peter O'Reilly

With HTML output, you do not have much control on how things are printed
(JavaScript will not help much in that regard). You are for the most part
at the will of the web browser. If you want more control, then send the
output as PDF document as one example.
 
A

ap

Peter O'Reilly said:
With HTML output, you do not have much control on how things are printed
(JavaScript will not help much in that regard). You are for the most part
at the will of the web browser. If you want more control, then send the
output as PDF document as one example.


Is the PDF generated in server side and send it back to the client side to print???
 
P

Peter O'Reilly

Is the PDF generated in server side and send it back to the client side to
print???

Yes, correct. You need a third party tool to create the Portable Document
Format (PDF) file. One place to start is Adobe software.
 
P

Paul

ap said:
As I know it is a server side printing... and is that possible to make it
to client side printing or it must be printed using javascript??

Sorry for late respone....

There was a method of server side printing to a shared printer in a
domain in ASP that used WSH to achieve its result. I've long ago lost
the details, but wondered if there was anything similar in .Net? What I
want to achieve is for a user to be able to enter some details of a
received item and have a ticket/docket print out to attach to the item.
The printer will be attached to a print server (jet direct type) on the
network (Intranet)

P.
 
H

Howard Rothenburg

You can print whatever custom information you want, including text
from controls, using javascript. You can open up a window with
javascript from the ASP.Net Page. Write what you want to print to the
window. Then have a link to print that window. Add the javascript into
the head on the ASP.NET page in the design view's HTML tab.

<script language =javascript>
function PrintResults()
{
var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
sOption+="scrollbars=yes,width=750,height=600,left=100,top=25";

var sWinHTML = document.getElementById('MyTextBox').innerHTML;

var winprint=window.open("","",sOption);
winprint.document.open();
winprint.document.write("<HTML><Head></Head><Body>")
winprint.document.write("<a href='javascript:;'
onClick='window.print();return false'>Print This Page.</a><br>");
winprint.document.write(sWinHTML);
winprint.document.write("</Body></HTML>")
winprint.document.close();
winprint.focus();
}
</script>
 
P

Paul

Howard said:
You can print whatever custom information you want, including text
from controls, using javascript. You can open up a window with
javascript from the ASP.Net Page. Write what you want to print to the
window. Then have a link to print that window. Add the javascript into
the head on the ASP.NET page in the design view's HTML tab.

Again sorry for late response.... I've been away.

Thanks for the advice and code snippet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top