I’m getting an exception try to print a Word document. (See the exception and code below.)
So I have a couple questions.
Does the printing functionality really work in Aspose.Words? I’ve tried search the site for information on this and I’m getting fixed info. Is this feature still in beta? If yes, when will it be released?
If printing is not available, can I convert the word doc to a PDF and print the PDF using Aspose.Pdf? Is there another alternative to using Word to print the document?
If printing is available, is there any sample code for this on the web site. Again I searched the site but I didn’t find anything.
Here is the code I’m using.
Aspose.Words.Document doc = new Document(@"C:\Temp\Worksheet1.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
Bookmarks bookmarks = doc.Range.Bookmarks;
for (int i = 0; i < bookmarks.Count; i++)
{
Bookmark bookmark = bookmarks;
bookmark.Text = "TESTING!";
}
builder.MoveToBookmark("UserText3");
builder.Write("This is a test for Aspose.Words!!!");
DocumentRenderer renderer = new DocumentRenderer(doc);
renderer.Print();
doc.Save(@"C:\Temp\Worksheet1.doc");
The exception I receive is:
System.StackOverflowException was unhandled
An unhandled exception of type ‘System.StackOverflowException’ occurred in mscorlib.dll
I’m using version 3.6.1.0 of Aspose.Words for .Net. I downloaded this a few days ago to evaluate your product. So far the evaluation is going well but we require a solution that can print Word or PDF documents.
Thanks,
Scott