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

Free Support Forum - aspose.com

Aspose.Words.Viewer

Hi,


I am trying to access the Aspose.Words.Viewer namespace in Aspose Words version 9.3.0.0. I was able to access it in version 5.2.2.0.

If this namespace is no longer available in version 9.3.0.0 can anybody tell me how to access the PageNavigator and DocumentRenderer classes. If these classes are no longer available is there a work around to viewing a word document (without using Ms word) and then print.

Thanks


Hi Sydanny,

Thanks for your inquiry.

The Aspose.Words.Viewer beta was replaced with a new rendering engine in later versions. This allowed for a lot more functionality. You can now render to PDF and images simply by invoking the Save method. To render to the different formats you simply pass the extension that you want to save as. For example to save as PDF you pass the file name ending with ".pdf" or to save as Jpeg you pass the file name ending with ".jpg" etc. You can also pass the SaveFormat and other options using the SaveOptions class and the classes derivied from it.

For details about printing please view the artcle here.

If you have any further queries please feel free to ask.

Thanks,

Thank you Adam, I am currently checking out the link on Rendering and Printing and trying to use the example to preview a document.


According to the steps I should initialize the preview dialog with the number of pages to display, but when I tried doing this I am getting an object reference error where I specify the MinimumPage.

Dim doc As Document = New Document(“C:\AsposeWord_Test\wordDoc.doc”)

’ Initialize the Print Dialog with the number of pages in the document.
Dim printDlg As New PrintDialog
printDlg.AllowSomePages = True
printDlg.PrinterSettings.MinimumPage = 1
printDlg.PrinterSettings.MaximumPage = doc.PageCount
printDlg.PrinterSettings.FromPage = 1
printDlg.PrinterSettings.ToPage = doc.PageCount

Am I doing something wrong?


Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. The code works fine on my side. Could you please create simple application, which will demonstrate the problem on my side? I will check it and provide you more information.

Best regards,


Thank you for responding Andrey. I have attached a simple app with a test word document. When I try to step through the code the object reference error pops up when I try to assign a value to MinimumPage as I mentioned before.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Please just change the following line of code:

printDlg.PrinterSettings.MinimumPage = doc.PageCount

with this one:

printDlg.PrinterSettings.MaximumPage = doc.PageCount

There should be MaximumPage instead of MinimumPage

Best regards,

Thank you for your quick response Andrey, that was just a little error in my code, but if you should change the MinimumPage to MaximumPage and try to step through the code you will still get the object reference error.


If seem I need to Initialize something but I don’t know what or how at this point.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I cannot reproduce the problem on my side. Could you please provide me a full stack trace of the exception? Maybe it will help to understand what is going wrong.

Best regards,

Andrey, see attached the full stock trace

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I still cannot reproduce the problem. I have opened your project on my side using Visual Studio 2005 (I don’t have VS 2003 installed) and all works fine.

Best regards,

Thank you for you quick response once again. I think the problem is VS 2003 because I created a project in VS 08 and code run fine.


This poses a tad bit a problem for me as I am doing work for my company and they use VS 2003.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Could you please try removing all code related to Aspose.Words from the button and try to run application. I suppose the problem still will be there.

Best regards,