I am working on WPF application and facing some issues in Printing. PrintQueue.GetPrintCapabilities().PageMediaSizeCapability collection doesn’t having all PageMediaSize supported by printer. I am using hp officejet 7610 driver (which supports A3 PageMediaSize). But PrintQueue.GetPrintCapabilities().PageMediaSizeCapability collection doesn’t having A3 PageMediaSize. Because of this, printer prints the page with its default / selected PageMediaSize.
For example, I have a page which size is A3 (1122.5 * 1587.4).And i am trying to print the page in A3 sheet (1122.5 * 1587.4) but printed area only (796.8 * 1123.2).
However, I have tried to set custom PageMediaSize for PrintTicket like the following.
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISOA3);
(or)
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISOA3, 1122.5, 1587.4);
(or)
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(1122.5, 1587.4);
Tried all other A3 related PageMediaSize (ISOA3, ISOA3Extra, ISOA3Rotated, OtherMetricA3Plus). Unfortunately, this is not working. The printer ignores the custom paper size which I'm trying to set. I've tried with several printer drivers and the result was the same.
Also, I have tried PrintQueue.MergeAndValidatePrintTicket like the following,
PrintTicket pt = new PrintTicket();
pt.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISOA3, 1122.5, 1587.4);
pt.PageMediaType = PageMediaType.None;
System.Printing.ValidationResult result = printDialog.PrintQueue.MergeAndValidatePrintTicket(printDialog.PrintQueue.DefaultPrintTicket, pt);
printDialog.PrintQueue.UserPrintTicket = result.ValidatedPrintTicket;
printDialog.PrintQueue.Commit();
Unfortunately, this is also not working.
Finally, the question is how to set custom PageMediaSize to PrintTicket (or) how to get all the PageMediaSize which the printer supports? Can any one please suggest us how to achieve the expected result?