I am trying to display a list of installed printers on the local computer using the method described on MSDN ...
using System.Drawing;
using System.Drawing.Printing;
namespace SandBox
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
{
Console.WriteLine(PrinterSettings.InstalledPrinters[i]);
}
Console.ReadLine();
}
}
}
The problem is on the Using statement, the 'Printing' namespace cannot be resolved.
Is there an additional reference I am missing?
UPDATE: I have added references to System.Drawing & System.Printing but this does not resolve the problem.
In order to use the System.Drawing.Printing namespace, you must reference the assembly System.Drawing.dll
In .Net Core and .Net Standard, System.Drawing.Printing can be installed via nuget Microsoft.Windows.Compatibility
Docs: https://learn.microsoft.com/en-us/dotnet/core/porting/windows-compat-pack
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With