Aspose is not working in windows server

HI Team
I downloaded aspose from .net nougat package and created one windows form application. it is wokring in fine in my local. application is not working inside windows server 2016 when Print() start executing.

Hi Team
I downloaded aspose.word using visual studio as visual studio nuget package and got two dlls. I created on windows application by adding Print() method of aspose in it. Application is working fine but when I used the application in windows server 2016, application is not working. While the Print() call it is failing and throwing error. Do I need to install aspose.word in server to make it work?

@hari_narayanan_sjc

Please note that Document.Print method is not available in .NET Standard 2.0. Please read the more detail from following article.
https://docs.aspose.com/words/net/xamarin-and-net-standard-2-0-limitations-and-api-differences/

Could you please share the exception that you are facing on Windows Server 2016?

hi team
Thanks for your reply. I am using the latest version of .net inside the server and also I am using .net System.Drawing class to get print to file option.
While I call Print(PrinterSetting) I am getting expection inside server.

@hari_narayanan_sjc

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please share the .NET version that you are using.
  • Please share the stack trace of exception.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Team
I created a windows forms application to create prn file of doc file.
To achieve this, I downloaded Aspose.Word by Visual studio nuget package. I didn’t install the aspose, only download it nuget package. I used Print(PrinterSettings printerSettings) method for prn createion.
Application is wokring fine in my mahcin where I have visual studio.

When I run the same application in windows server, I am getting the below error while Print method invoke.

Error:

System.ComponentModel.Win32Exception(0X80004005): The system cannot find the path specified
at
System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocumentdocument, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at Systen.Drawing.Printing.PrintDocument.Print()
at Aspose.Words.Documents.Print(PrinterSettigns printerSettings, String documentName)
......

.Net Version 4.8.03761 is installed in the server, where I am trying to run my application.
Do I need to install aspose in the server or just placing below two dll is enough?
Aspose.Words.dll
Aspose.Words.Pdf2Word.dll

@hari_narayanan_sjc

Thanks for sharing the detail. Please make sure that your application has access to document and your Visual Studio target framework is .NET Framework instead of .NET Standard. We suggest you please use Windows absolute path for your document in your application.

We need following resources to test this case. If you cannot supply us with this information we will not be able to investigate your issue and raise a ticket.

  • Please share the target .NET version of your application.
  • Please ZIP attach your Visual Studio project and document.
  • Your operating system architecture (32/64 bit) for local system and Windows Server 2016.

Thanks for your cooperation.

Hi Team
We found the issue.
The problem is using printersetting class.
We want to generate prn using Aspose.Print() method and save it in one place.
We want to this without using printersetting class. is it possible?

@hari_narayanan_sjc

We suggest you please save your document to PCL file format and use it according to your requirement. Hope this helps you.

Following article shows how to save document to PCL file format.
https://docs.aspose.com/words/net/save-a-document

Hi Team

We need your help in the below area.

Adjective :
We have created a new application by replacing the word with aspose.
The existing application in using word template .dot and giving output as .doc
that .doc output is converted into .prn using PrintOut()

Now the new application which we create is using .dotm and giving output as .doc
we are using Aspose.Word Print() method to convert .dco to .prn

Issue:
The output of word and the output of aspose is not matching

Request:
How to convert the .doc to .prn using pcl language similar to word

@hari_narayanan_sjc Could you please attach the problematic document along with sample code here for testing? we will check the issue and provide you more information.

Hi Team

I have attached three documents.

  1. PRNCheck.DOC - input DOC document
  2. AsposeOutput.PRN - output created using the below c# code using Aspose.
  3. wordoutput.prn - output created using word object.

The output of AsposeOutpu.PRN and wordoutput.prn are not the same, could you please let us know how to create a prn similar to word using Aspose.

We are using the below code in our C# application to convert DOC to prn.

public void PrintDocument()
{
string PRNfilename = @"c:\temp\output.PRN";
string filename = @"c:\temp\Input.DOC";
System.Drawing.Printing.PrintDocument PrintDocument_obj = new System.Drawing.Printing.PrintDocument();
Aspose.Words.Document AWS_obj = new Aspose.Words.Document(filename);

PrintDocument_obj.PrinterSettings.PrintToFile = true;

PrintDocument_obj .PrinterSettings.PrintFileName = PRNfilename;
//Configuring tray setting in Aspose object.
foreach(Aspose.Words.Section section in AWD_obj.sections.OfType<Section>())
{
section.PageSetup.FirstPageTray = 257;
section.PageSetup.OtherPagesTray = 257;
}
AWD_obj.Print(PrintDocument_obj.PrinterSettings);
}

(Attachment wordoutput.prn is missing)

(Attachment PRNCheck.DOC is missing)

(Attachment AsposeOutput.PRN is missing)

@hari_narayanan_sjc Unfortunately, I cannot see the attached documents. Could you please zip them and attach here again? We will check the issue and provide you more information.

New folder.zip (78.6 KB)

@hari_narayanan_sjc Thank you for additional information. I have checked both PRN files and as I can see document layout is the same. The only difference is an evaluation watermark inserted into Aspose.Words produced PRN.

Could you please elaborate a bit more what you mean? MS Word and Aspose.Words uses different layout engines so the instructions in the resulting file might be different. But the layout of the resulting document is the same.

Hi Team

We want to generate the prn output similar to word using Aspose.

Instructions in the resulting file should be the same as word.

Thanks
Hari Narayanan

@hari_narayanan_sjc I am afraid, it is not possible to generate binary the same output as MS Word does. As I already mentioned Aspose.Words and MS Word used different layout engines.