Print in Aspose.Words from a Stream

Hi - I have a Stream which I get from a database blob (dataAsp1.bin) - which is a Word Document.
Aspose only prints a empty page when I execute the code below (Asp.net 2.0 / C#)
(Yes, I know, it will only print on the server - but it should print not only empty pages - right :wink:

docviewer.Document.GetText().ToString();

Reads the Blob (Word) perfectly into a string.

Can you point me to a solution that will work? Thanks! Btw: I really like your Products, they helped me a lot!

MemoryStream streamIn = new MemoryStream(dataAsp1.bin);
MemoryStream streamOut = new MemoryStream();
const string licFile = @"Aspose.Total.lic";
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(licFile);
Aspose.Words.Document Doc = new Aspose.Words.Document(streamIn);
Aspose.Words.Viewer.DocumentRenderer docviewer = new Aspose.Words.Viewer.DocumentRenderer(Doc);
docviewer.PrinterSettings.PrinterName = "Canon i250"; 
docviewer.PrinterSettings.FromPage = 1;
docviewer.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.AllPages;
docviewer.PrinterSettings.Copies = 1;
docviewer.Print();

I have a same problem. If you get a solution could you please email me?

Thanks,

Maulik

ok, it looks like I found the solution:

I had a look at the Printersettings with:

Response.Write(docviewer.PrinterSettings.ToString());

and recognized that PrintSettings.ToPage was set (by default) to 0

I set it to 1 and it prints (yeah!)

Hi jangeis,

thanks for your reply, It works for me as well.

Is there any method to find out how many pages are there in the document?

Thanks

It looks like the answer is no. Which is really annoying considering the fact that you need the pagenumbers when you want to print the whole doc.
Maybe they fix this problem next week with the new release. Do you guys? Is there another possiblity to say “just print everything” ?

PrintRange.AllPages - does also not help here …

Hi,

We will take a look at the issue but no promises. I posted on the forum numerous times that we do not improve the beta of the viewer as it diverts us from working on the final version with different codebase. Please wait a while, the more efforts we make to work on the “main” viewer, the sooner it will be out.

Hi,

Thanks for your reply.

Could you please advise the tentative date for the “main” viewer, to be available.

Regards,

It will be released somewhere in 2006, no information about more exact ETA as stated here.

We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

Saving to image

In additional, new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

Saving to Pdf

The latest version of Aspose.Words is available for download from downloads section or from NuGet