Answer the question
In order to leave comments, you need to log in
How to set up WPF printing: number of copies, printer selection, orientation?
I can print, but I can't set up the printer.
Namely, these lines give an error:
//определение принтера
printDialog.PrintQueue = GetPrintQueues();
//Количество копий
printDialog.PrintTicket.CopyCount = 3;
printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
private void Button_Click_1(object sender, RoutedEventArgs e)
{
PrintDialog printDialog = new PrintDialog();
//определение принтера
// printDialog.PrintQueue = GetPrintQueues();
//Количество копий
// printDialog.PrintTicket.CopyCount = 3;
//printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
if (printDialog.ShowDialog() == false)
{
//Определить поля
int pageMargin = 10;
//Получить размер страници
Size pageSize = new Size(printDialog.PrintableAreaWidth - pageMargin * 2, printDialog.PrintableAreaHeight * 20);
//Инициировать установку размера элемента
canvas.Measure(pageSize);
canvas.Arrange(new Rect(pageMargin, pageMargin, pageSize.Width, pageSize.Height));
//Напечатать элемент
printDialog.PrintVisual(canvas, "Распечатать элемент Canvas");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question