I print to a remote printer loaded with 8.5 x 8.5 paper . When I print, the printer ejects 11 inches instead of 8.5.
PageMediaSize pageSize = new PageMediaSize(PageMediaSizeName.Unknown, element.Width, element.Height);
PrintDialog dialog = new PrintDialog();
dialog.PrintTicket.PageMediaSize = pageSize;
Console.WriteLine(dialog.PrintableAreaHeight);
dialog.PrintQueue = myQueue;
Console.WriteLine(dialog.PrintableAreaHeight);
dialog.PrintVisual(element, description);
Usage How to convert Twips to Pixels to .NET? “I determined that 8.5 inches is 816 pixels, which is the size of my element.Widthand element.Height. I am setting a new one PageMediaSize, but this does not seem to have an effect, dialog.PrintableAreaHeightit still ends at 1056 when I set the queue in the dialog box.
If I do dialog.ShowDialog(), manually select my printer and manually locate and resize the paper in your advanced printer settings, then dialog.PrintableAreaHeightcorrectly reflect the change.
This page http://go4answers.webhost4life.com/Example/set-printdialogs-default-page-size-168976.aspx suggests that I can only install PageMediaSizesupported by my printer. Using the function GetPrintCapabilitieson mine PrintQueue, I see a list of 10 or so page sizes, none of which are 8.5 x 8.5. This is the same list that I see when I go to my printer settings in Windows.
epalm source
share