4

I want to print a very simple layout with PrintDocument that fits on one page, so it doesn't require a DocumentPaginator. However I want to use PrinterDialog to select the printer. I saw examples with PrinterSettings being a property of PrinterDialog and it was simply assigned to the PrintDocument. But this doesn't seem to be possible anymore. I also looked for other solutions like custom paginator classes to use but came up empty. I might not have this deep insight into WPF, but why must it always be dongled that way...

CJBS
  • 15,147
  • 6
  • 86
  • 135
thomiel
  • 2,467
  • 22
  • 37

1 Answers1

4

Try this:

  • Import System.Printing
  • Create a PrintDialog

And then:

PrintDialog printDialog = new PrintDialog();
printDialog.PrintQueue = new PrintQueue(new PrintServer(), "PrinterName");
printDialog.PrintDocument(document, "PrintDocument");
Sam R.
  • 16,027
  • 12
  • 69
  • 122
  • 3
    Thanks for pointig me to PrintQueue. With printDocument.PrinterSettings.PrinterName = printDialog.PrintQueue.FullName, I only hope the Name is compatible in every case... – thomiel Apr 16 '13 at 12:09