Printing a Word Document with Printer Settings & Print Preview Dialogs using C# .NET

Hi, can u help me to fetch a word document from local path and print it in server side(browser)without any formatting error

@N497655,

The Aspose.Words’ Document object provides a family of Print methods for printing Word documents in your server-side applications. These methods use the .NET printing classes defined in the System.Drawing.Printing namespace.

okay.but i want to call a document from loacal path and while clicking print button i want to get print preview of choosen document,where the user will choose printer name.please guide me how to call document from path and display in print preview

@N497655,

Please refer to the following section of documentation:

when i tried to use above code i am getting error in RunExamples,PrintDialog,PrintPreviewDialog,AsposeWordsPrintDocument these declarations.do i have to include any dll for adding these above mentioned .please help me on this

@N497655,

You need to add reference to System.Drawing and System.Windows.Forms assemblies. I have attached a runnable console application here for your reference.

1 Like