Aspose.Words Print To File capability (.NET 5.3.0)

I am trying to print a Word Document (either created dynamically or loaded from existing file) to a Print File. See my code below. It succeeds but I get 2 empty pages in the output file. I manually printed to a file using same print driver, etc. and it works fine. I verified the word doc file exists. Please advise if this feature works in the latest version (5.3) or not. I am using the trial version (we have a license but won’t work on this version). If it is supported, then what am I doing wrong?

DocumentRenderer dr = new DocumentRenderer(DOC_FILE_NAME);
dr.PrinterSettings.PrinterName = DEFAULT_PRINTER;
dr.PrinterSettings.PrintToFile = true;
dr.PrinterSettings.PrintFileName = PRINT_FILE_NAME;
dr.Print();

Thank You!

Hi
Thanks for your inquiry. Could you please attach your document for testing? Also note that Aspose.Words.Viewer namespace is currently in beta and limited technical support is provided for it.
Best regards.

You can use any word file you like. The one we use is attached.
Thanks for the follow up.

Hi
Thank you for additional information. This works fine on my side. Here is my code:

Document doc = new Document(@"Test191\in.doc");
DocumentRenderer renderer = new DocumentRenderer(doc);
renderer.PrinterSettings.PrinterName = @"\\10.100.167.152\hp LaserJet 1010 Series Driver";
renderer.PrinterSettings.PrintToFile = true;
renderer.PrinterSettings.PrintFileName = @"C:\Temp\out.prn";
renderer.Print();

Then I print PRN file and output looks good.
What tool are you using to view PRN files?
Best regards.

Could the issue be that I am using the eval version? If I had the proper license, maybe it would work. Just wondering if that could be the issue.
What are your thoughts on this?
Thanks.

Hi
Thanks for your inquiry. I don’t think this is the reason of the problem. What tool are using to view PRN files?
Best regards.

WE use SwiftView to view PCL and PRN files. Have been using it for years now. Should not be a problem there.
Could you attached the prn file you produced so I can see if the SwiftView works on it?
Thanks.

Hi
Thanks for your inquiry. I attached my PRN file.
Best regards.

It is working fine now. After you waved your magic wand, no problems. I did not changed anything and it is working, same code I sent you.
Appreciate your help and timely follow up. Excellant work.
Thanks.

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