tags:

views:

62

answers:

0

Hi

PrintCapabilities printCapabilites = SelectedPrinter.GetPrintCapabilities();
IEnumerable<PageMediaSize> pagesizeList = printCapabilites.PageMediaSizeCapability;

The above code does not list all the page sizes that the printer driver supports and this is my problem.

As an example if you use the Microsoft XPS printer driver you will find that pagesizeList (above) will be missing some page sizes. "Letter Small" is one of the missing page sizes (MS Word will successfully list this page size though).

As a quick check I dumped the Printer capabilities to xml as below:

long gpCLen = _selectedPrinter.GetPrintCapabilitiesAsXml().Length;
FileStream fs = File.OpenWrite(@"c:\test.txt");
MemoryStream ms = _selectedPrinter.GetPrintCapabilitiesAsXml();
byte[] b = new byte[gpCLen];
ms.Read(b, 0, (int)gpCLen);
fs.Write(b, 0, (int)gpCLen);
fs.Close();

The PageMediaSize node in the xml file produced does indeed have all the page sizes, AND the missing ones.

Displayed pages seem to have their name start psk:

<psf:Option name="psk:ISOA4" constrained="psk:None">

but undisplayed pages seem to have:

<psf:Option name="ns0000:LETTERSMALL" constrained="psk:None">

Undisplayed Epson print driver pages are similar:

<psf:Option name="epns200:IndexCard5x8" constrained="psk:None">

Basically a page whos name starts 'psk' PageMediaSizeCapability displays, but if it's manufacture custom ie epns200, ns0000, it doesn't list. Any ideas why and how to fix this please? The nodes/Pages are there but PageMediaSizeCapability doesn't like it!

Thanks in advance

EDIT:

As MS state 'A PrintCapabilities object is an easy-to-work-with representation of a certain type of XML document called a PrintCapabilities document.' But the document has more info than the object Full description