hi all
i have problem to access the default printer using C# code.....
i am created the .Net Application for Bill Printing.
i have two Desktop PC connecting thru LAN. Named like x86 and x96 both have the individual defalult printer.
x86 machine have the .Net application.Run the application from this machine and click the print button then the bill was printing x86 machines default printer.
When i am trying to open the apllication from x96 machine using http://x86/ApplicationName/Pagename.aspx
now i can click the print button for bill printing.here is the problem rises......
the printing command goes to the x86 machine only (which one have the .Net applicaion)
its did not detect the local printer of x96 machine.
this is the problem.... Really i am struggle with this plz help me....
Note :
i wanna format printing option so only am using this code....
i dont wanna Java scripts " document.Print() " function.
am waiting for ur reply....
Regards
Srinivas.
C# Code
"
using System.Drawing.Printing;
private
PrintDocument printDoc = new PrintDocument();
private
void InitializeComponent()
{
this.cmdPrint.Click += new System.EventHandler(this.cmdPrint_Click);
this.CmdLaser.Click += new System.EventHandler(this.CmdLaser_Click); // For Printing Event
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
private
void printDoc_PrintPage(Object sender , PrintPageEventArgs e)
{
String textToPrint = LaserGenerateBill(); //Calling function return String value
Font printFont =
new Font("Courier New", 10);
e.Graphics.DrawString(textToPrint, printFont, Brushes.Black, 0, 0);
}
private
void CmdLaser_Click(object sender, System.EventArgs e)
{
try
{
Margins xx=
new Margins(0,0,0,0);
PaperSize psize=
new PaperSize("bill",8,4);
this.printDoc.Print();
}
catch(Exception excLocal)
{
this.lblError.Text = excLocal.Message;
}
}
"