StartDocPrinter error

Hi –

We are experiencing a problem when issuing a Print command from the aspose.words.document object.

The error seems to originate in System.Drawing, and reads as “a StartDocPrinter call was not issued”. Have you encountered this before? I don’t see much info about it on the forums. The code that makes the aspose print call is in a dll that is referenced by a .NET console app. It has worked fine for the past year and a half and the code has not been changed. This is on Win-7.

Thanks - bob kells

Hi Bob,

Thanks
for your inquiry. This issue seems not to be related to Aspose.Words. Please note that the Aspose.Words Print method
uses System.Drawing and standard .NET printing classes.

Please try following code snippet for testing at your end. 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. Please let us know if you have any more queries.