0

How can I show the print dialog in the Preview Dialog when I click to the Print button?

enter image description here

Currently, when I click in the print button, it just show this:

enter image description here

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Using a custom printer driver to convert *any* printed output to the PDF format is an old trick. Microsoft recently adopted it, I think Ghostwriter was an early pioneer It will never actually print to a printer, output goes to a .pdf file. You see the driver prompting for the file location. So it is all just working the way it should, hard to guess at your question. – Hans Passant Aug 10 '16 at 13:02

2 Answers2

0

Using the PrintDialog works fine for me...

new PrintDialog().ShowDialog();

I think what you are actually using is:

printDocument1.Print();

but this won´t show up the dialog, you want to use ;)

BingBingBong
  • 88
  • 10
0

This is by design. The PrintPreview dialogue uses the Windows default printer. It has to know what printer driver to use to render the image. The Print dialogue allows you to change printers and settings. You can't change printers or settings in PrintPreview but the solution below gets around that by showing the Print dialogue first and then PrintPreview, although I have not tested the code myself. How to present print settings from print preview? Here's the sample code they provide in this solution:

private void previewButton_Click(object sender, EventArgs e)
{
    PrintDialog printDialog = new PrintDialog();
    if (DialogResult.OK == printDialog.ShowDialog())
        {
             PrintPreviewDialog printPreview = new PrintPreviewDialog();
             printPreview.Document = printIssues;

             // this is were you take the printersettings from the printDialog
             printPreview.Document.PrinterSettings = printDialog.PrinterSettings;

             printIssues.DefaultPageSettings.Landscape = true;
             printPreview.ShowDialog();         
        }  
}
Tank252ca
  • 1
  • 2