Hi, I'm using Aspose.Words to print docx documents through a website (Windows Server 2008, IIS7). I am getting "No printers are installed" error. It only works when the user account is logged in locally on the server. Please advise. Thanks.
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.
PrinterSettings printerSettings = new PrinterSettings();<o:p></o:p>
printerSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";<o:p></o:p>
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();<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>
private void Doc_PrintPage(object sender, PrintPageEventArgs e)<o:p></o:p>
e.Graphics.DrawImage(Image.FromFile(@“Common\test.jpg”), e.MarginBounds.Left, e.MarginBounds.Top);<o:p></o:p>
This code just prints an image. Please let us know if you have any more queries.
The code you supply works. The printer is installed locally, but the code above works whether I set the printerName as the local name or the network path (shared printer).
I have narrowed the problem to using PageSettings and setting it to on Aspose.Words.Document.DefaultPageSettings
System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();Calling Print() throws the error "No printers are installed".System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();Aspose.Words.Document doc0 = new Document(docMemoryStream);AsposeWordsPrintDocument wpd0 = new AsposeWordsPrintDocument(doc0);wpd0.PrinterSettings = ps;wpd0.DefaultPageSettings = pgs;wpd0.Print();
Also, the Print() takes over a minute to print a one page document with 2 lines on it.
I downloaded v11.9.0 and I still have the same "No printers are installed" issue.
Printing now seems to be hang. It printed 30 minutes later, right after I reran it with the original version that I was using. Coincidence?
Please advise. This is becoming an urgent matter.
Again, this does not happen when I run it locally, but when using IIS7 on Windows 2008 server.
Forgot to include, current version of Aspose.Words.dll is 188.8.131.52.
Webiste is hosted on IIS7 on Windows 2008R2 64-bit.
A webpage has a print button, which uses Aspose.Words.dll to perform a mailmerge on a Word (.dox) document. This works fine.
This is saved as a memory stream and then printed with the code snippet I provided earlier. I use the PageSettings object to
set the PaperSource (printer tray). (Code is in C#)
Running in this scenerio cause the 2 issues I am experiencing.
If I run the code locally using Visual Studios' ASP.NET Development Server (which runs on my local computer), it works.
Thanks for getting back to me. How soon do you think this will be resolved? Do you have a workaround? Thanks, Eran.