We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Printing using aspose.words for .net

Hi,
I can print my document fine when it is on my local PC, but, when I mode the code to a web production server, it gives me an error"No printer is installed". Isnt supposed to print from whatever printer the client has and not from teh server printer?.
here is trhe method I am using:

Aspose.Words.Document document = new Aspose.Words.Document(Server.MapPath(path));
document.Print();

Please advice.
Thank you

Adel

Hi

Thanks for your request. Printer should be installed or available (in case of network printer) on the PC where you are running the application. There is no way to print document on client side using Aspose.Words.

Best regards.

I installed a printer on the server and I am running the application from the server and it still says "No printers are installed". This works good on my local machine though. Any ideas?. Thanks

Hi

Thanks for your request. Document.Print() method will print document on the server side. So, make sure the printer on your server is properly installed and accessible.

In case of using network printer, please make sure that name of the network printer is specified correctly. Make sure that name of the machine is specified correctly.

You can try specifying name of network printer using IP address. On my side I use the following printer name:

PrinterSettings printerSettings = new PrinterSettings();

printerSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";

doc.Print(printerSettings);

Also, make sure that you have rights to print on this printer. You can try using the following code for testing. This code does not use Aspose.Words at all. So if it will not work, the problem is somewhere on your side.

PrintDocument doc = new PrintDocument();

doc.PrinterSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";

doc.PrintPage += Doc_PrintPage;

doc.Print();

============================================================================

private void Doc_PrintPage(object sender, PrintPageEventArgs e)

{

e.Graphics.DrawImage(Image.FromFile(@“Common\test.jpg”), e.MarginBounds.Left, e.MarginBounds.Top);

}

This code just prints an image.

Best regards.

In addition, maybe in your case you should use approach as described here to print your document on the server side:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/howto-print-a-document-on-a-server-via-the-xpsprint-api.html

Best regards.

Thanks very much for your reply. I am not trying to print on the server side. Let me explain the application. Its just like any other web app. The app resides ofcuorse on the server, the user who is just like any web user, uses an hhtp request to view a doucment which resides on the server. Now, the user wants to print this document. so, in my code I use this method document.print which I am expecting it to print the doument that the user is viewing but on his/her local/network printer, whatever the defult printer is on that user pc. I hope this make it more clear so you can help me making some suggestions why I am getting this error message. Please advice. Thanks again

Hi

Thank you for additional information. I understand your requirements, but as I already mentioned earlier, there is no way to print document on the client’s side using Aspose.Words.

Best regards.

Thanks again for your response. Do you have any products that will satisfy this requriment. It does not have to be Aspose.Words.

Hi

Thanks for your request. There are no other Aspose products, which can print Word documents. In your case, you can try converting your document to images and then print images on client side using JavaScript.

http://www.tek-tips.com/viewthread.cfm?qid=1514145&page=6

Here you can learn how to convert document to image:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.document.savetoimage_overloads.html

Best regards.