I have a PrintCapabilities object and now I am trying to check if the printer supports ISOA4 page media size so that I can iterate over the readonly enumeration
:
PrintDialog print = new PrintDialog();
PrintCapabilities pc = print.PrintQueue.GetPrintCapabilities(print.PrintTicket);
foreach (PageMediaSize mediaSize in pc.PageMediaSizeCapability)
{
if (mediaSize.PageMediaSizeName == PageMediaSizeName.ISOA4)
{
Console.WriteLine("A4 size is supported");
break;
}
}
I am trying to do the same using Linq without success. Is it possible? If so, how?
You should be able to do something like this (sorry - I haven't tested this code).
if (pc.PageMediaSizeCapability.Any(ms=>ms.PageMediaSizeName == PageMediasizeName.ISOA4))
{
Console.WriteLine("A4 size is supported");
}