Server side .NET printing from asp.net

I have a Windows server running an ASP.NET application and a local printer connected to this machine. I need to print some documents from server code.

So far, I know that in .NET there is no managed API supported on the server (service) side.

  • The System.Printing namespace is part of WPF and is not supported for server-side launch, as it can throw runtime exceptions (tested on msdn)

  • System.Drawing.Printing is part of WinForms and is also not supported for server-side operation (tested on msdn)

The same problem was developed with Microsoft back in 2009, and the solution was to use the unmanaged XPS print API as the only supported way back at that time. The described problem and solution with the published example here: How to print a document on the server using the XpsPrint API

However, this is currently a problem as the XPS print API is marked as unsupported and may not be available in the future ( msdn ).

So what is the supported way to print from server code?

It looks like there are more Win32 APIs that could be used, but there is no information on the Internet, and this is likely to be a nightmare ...

Commercial decisions are made. Thank.

+4

All Articles