Printing support in .net core

14,172

Solution 1

.NET Core 3 supports System.Drawing.Printing

I have an app sorta working on Linux now. I'm experiencing some weirdness which led me to this question.

FWIW, my app is a pretty complete example of how to use the System.Drawing.Printing APIs. Find it here: https://github.com/tig/winprint

Solution 2

One option is to split monolithic service(s) into multiple microservices and run your .NET Core app under i.e. Linux and let your print service on windows and have the .NET Core service call into the print service when it needs to print something

Solution 3

System.Drawing is windows-dependent and excluded from cross-platform NETStandard libraries (not available for .NET Core apps).

As alternative you may consider composing PDF or PS document (for instance, wkhtmltopdf tool can convert HTML pages to PDF/PS formats) and sending it to printer with OS-specific command line tool (for linux this might be "lp" command; for windows PowerShell "lpr").

Share:
14,172
Purnima Naik
Author by

Purnima Naik

Updated on June 14, 2022

Comments

  • Purnima Naik
    Purnima Naik almost 2 years

    My .net framework 4 service is using PrintDocument class of System.Drawing.Printing for printing.

    How can I achieve this in .net core. I am not able to find System.Drawing.Printing in .net core.

    Can someone guide me on this?