I have a label printer. Seiko SLP-440. When I ShowDialog the PrintDialog to print a visual the user has to click printing preferences, advanced, paper size to set the paper size. There are a lot of different label sizes. How can I assign both the
default printer and the paper size before ShowDialog the PrintDialog?
thanks,
thanks,
public static void PrintLabel( this BitmapSource InBms, Thickness InMargin, string InDescription = "Bitmap image") { PrintDialog pd = new PrintDialog(); bool? ret = pd.ShowDialog(); if (ret.Value == true) { Grid drawingArea = new Grid(); drawingArea.Width = pd.PrintableAreaWidth; drawingArea.Height = pd.PrintableAreaHeight; Image im3 = new Image(); im3.Margin = InMargin; im3.Source = InBms; im3.Stretch = Stretch.Fill; drawingArea.Children.Add(im3); Rect rect = new Rect(0, 0, pd.PrintableAreaWidth, pd.PrintableAreaHeight); Size size = new Size(pd.PrintableAreaWidth, pd.PrintableAreaHeight); drawingArea.Arrange(rect); drawingArea.UpdateLayout(); pd.PrintVisual(drawingArea, InDescription); } }