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

Free Support Forum - aspose.com

Print Word Document Programmatically or Using Dialogs | Print Revision Marks with Annotations & Preview Print using C# .NET

Please suggest same code for printing document without saving in existing file

  1. preview document using aspsoe words
  2. print with all pages / no.of copies
  3. print with some pages /no.of copies
  4. print with annotations
    I checked some links and which is clear with references ,
    Please suggest with code sample so that it will be useful .

@saranyasrinivasan92,

Please check the following article that demonstrates the methods of printing a document with Settings (from page, to page etc), Print preview, and Print progress dialogs.

To show/hide comments (annotations) during printing, please use the following setting:

For example, the following code will not print any comments:

Document doc = new Document("E:\\Temp\\Comment.docx");
doc.LayoutOptions.ShowComments = false;
doc.Print(); // send document to printer for printing

Please let me know if I can be of any further assistance.

I can see some sample code to set in VSTO
WordManager.WordObject.ActiveDocument.PrintRevisions = true; WordManager.WordObject.ActiveDocument.ShowRevisions=true;
WordManager.WordObject.ActiveWindow.View.ShowFieldCodes = true;
and also for print page range setting

if pages with range how to set in from and to
ex: im getting range 1,3,5 or 1-5 then i have to print accordingly

How to set the same in aspose? and can you attach sample code for print preview, i tried with above links showing refernces missing. kindly suggest.

@saranyasrinivasan92,

You can accept or reject revisions before sending the document to printer by using the following code:

Document doc = new Document("E:\\temp\\input.docx");
// doc.AcceptAllRevisions();            
foreach (Revision rev in doc.Revisions)
{
    rev.Reject();
}
doc.Print();

Please try Document.TrackRevisions Property to enable/disable Track Changes in document. There are also different options available in RevisionOptions class that you can try.

It seems that this information is not stored inside document but is related to MS Word application. But, you can try Field.Unlink Method to convert Field to Static Text or to get the field code, please use Field.GetFieldCode Method.

Please get the complete code of PrintPreviewSettingsDialog.cs from GitHub and make sure a reference to System.Windows.Forms assembly is added in your project.