Print File With .Net

Go To


I am trying to print via .NET with the following code....

OpenFileDialog ofd = new OpenFileDialog();
if( DialogResult.OK == ofd.ShowDialog(this) )
    // Allow the user to select a printer.
    PrintDialog pd  = new PrintDialog();
    pd.PrinterSettings = new PrinterSettings();
    if( DialogResult.OK == pd.ShowDialog(this) )
        // Print the file to the printer.
        RawPrinterHelper.SendFileToPrinter(pd.PrinterSettings.PrinterName, ofd.FileName);

The printer dialog window opens, and the print job is in the queue, however, nothing prints... and I can print otherwise.

2012-04-03 22:27
by jroberts


See the Print() extension method here:

2012-04-03 22:30
by Chuck Savage