i want to print to the client side printer in the same network in my asp.net application hosted in IIS.
i used the following print code. but it can only print to the printers installed to the server.
in the following code you can see i have added the printer path of the printer installed in the server "\\Server\LaserPrinter3501"
, but if i give the path of another shared printer in the same network, it will not print.
protected void btnprint_Click(object sender, EventArgs e)
{
prntKOT.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(3, 3, 3, 3);
PaperSize pSize = new PaperSize();
pSize.Width = 315;
pSize.Height = 380;
prntKOT.DefaultPageSettings.PaperSize = pSize;
prntKOT.PrintPage += new PrintPageEventHandler(prntKOT_PrintPage);
prntKOT.PrinterSettings.PrinterName = "\\Server\LaserPrinter3501";
prntKOT.Print();
}
private void prntKOT_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
g.PageUnit = GraphicsUnit.Millimeter;
float width = prntKOT.DefaultPageSettings.PaperSize.Width;
e.HasMorePages = false;
Font printFont = new Font("Arial", 8);
Pen p = new Pen(Brushes.Black, 0);
p.Color = System.Drawing.Color.Black;
p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
g.DrawString("Hello World !", printFont, Brushes.Black, 10, 10);
}
Please give a solution to do client side printing.