AvaloniaUI.PrintToPDF icon indicating copy to clipboard operation
AvaloniaUI.PrintToPDF copied to clipboard

how print usercontrol without show in windows

Open Upanc opened this issue 1 year ago • 1 comments

i create some report use usercontrol,i want print it without show

Upanc avatar Aug 28 '24 10:08 Upanc

I don't how how to print without showing it.

If this is acceptable, you can wrap your control inside a window and just show the window during printing.

var window = new Window
{
  Content = new SomeReportUserControl(),
  SizeToContent = SizeToContent.WidthAndHeight
};
window.IsVisible = true;
await Print.ToStreamAsync(stream, window);
window.IsVisible = false;

Oaz avatar Nov 03 '24 11:11 Oaz