Print File With .Net

Go To StackoverFlow.com

0

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

http://support.microsoft.com/kb/322091

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


1

See the Print() extension method here: https://stackoverflow.com/a/5751106/353147

2012-04-03 22:30
by Chuck Savage
Ads