Hi,
I have a requirement to send a print from the web application deployed on one of the servers. The printer is not installed on the server and is a network printer.
This works when I try sending print from my local machine. When the same code is deployed to the server, it doesn’t work. I tried using a test console application as well and its not working with Aspose.Print.
Please suggest.
Thanks,
Sulabh
Hi Sulabh,
PrintDocument doc = new PrintDocument();<o:p></o:p>
doc.PrinterSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";<o:p></o:p>
doc.PrintPage += Doc_PrintPage;<o:p></o:p>
doc.Print();
============================================================================
private void Doc_PrintPage(object sender, PrintPageEventArgs e)<o:p></o:p>
{<o:p></o:p>
e.Graphics.DrawImage(Image.FromFile(@“Common\test.jpg”), e.MarginBounds.Left, e.MarginBounds.Top);<o:p></o:p>
}
Thanks for the reply.
I have follow up points:
1. I cannot install the network printer onto the PRODUCTION server as its not allowed by our operations team.
2. The code snippet that you shared works fine for image files (jpeg etc). However, I am trying to print word/excel documents.
Can you please share the sample code to print a word/excel document from the server to a network printer?
Thanks,
Sulabh
Hi Sulabh,
Document doc = new Document(MyDir + “Document.doc”);<o:p></o:p>
doc.Print("KONICA MINOLTA magicolor 2400W");