Search code examples
.netprintingoffice-interopnpoi

Best Way to printing Office Document on WebServer


After spending hour and hour on Stack and other Programming forum, i ask this questions to get Rex (Return Of Experience).

What is the best way to achieve all this project goals :

  • print existing Office document (Docx, Doc, maybe some XLS and XLSx)
  • on a Windows Server without Ms Office installed o the server
  • print without Human actions, because it's on a web server
  • an open source or free library will be my first choice but we can buy a professionnal components (that will depends on how much it costs)

I'v already find that the NpOi project seems to read a lort of this formats, but i didn't see it can manage sending the file to the printer ! I am wrong ?

I didn't see a good related question on StackOverflow, but if someone has a good link, i'll be interested.

Best regards from Toulouse \France


Solution

  • You can use any third-party components (for example, Aspose) for printing documents on the server side.

    Be aware, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.