Click here to Skip to main content
15,391,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir,
I have a billing printer & i have made an aspx page with the help of visual studio 2010 and sql server has some textboxes and some labels and one print button.

i just want to print that aspx page... i dont want that print setup or print dialouge box it possible in webform ?? please help me out..i'm in big trouble if possible then please give me the source code of button click..please

Thank you......
Updated 26-Nov-20 1:45am
Member 15003686 26-Nov-20 7:47am
please provide the same in java script

Hello Vivek,

Could you please see the following link:
Printing Using C# - Changing the Page Settings[^]

I have taken following code from it.
Printing Without the Preview

To print to another printer, you have to use the standard print dialog. We can bring this up in much the same way, so add this method to PrintEngine:
// ShowPrintDialog - display the print dialog...
public void ShowPrintDialog()
  // create and show...
  PrintDialog dialog = new PrintDialog();
  dialog.PrinterSettings = PrinterSettings;
  dialog.Document = this;
  if(dialog.ShowDialog() == DialogResult.OK)
    // save the changes...
    PrinterSettings = dialog.PrinterSettings;

    // do the printing...

Again, if the user clicks OK we save the settings, but this time we also call Print to print directly to the configured printer. Add this event handler to Form1 to finish this off:
private void cmdPrint_Click(object sender, System.EventArgs e)
  // print...
Suvabrata Roy 11-Jun-14 2:38am
Vivek: was asking for his web form but your solution will work in desktop.
For Mozilla :

Javascript Code:
it will work for IE
if (navigator.appName == "Microsoft Internet Explorer")
var PrintCommand = '<object id="PrintCommandObject" width="0" height="0<br" mode="hold" />CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
else {
You should learn the command language your target printer supports (e.g. ESC/P, ZPL, EPL, etc) to get fast printing performance and then use any of these tools to print at client side without dialog or create one by yourself

qzprint[^]: free or paid options. requires JAVA VM at the client
WebClientPrint[^]: paid, requires jQuery & ASP.NET

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900