The Chilkat .NET DLL includes a SysUtil class that makes it easy to print from C# or VB.NET.
This example shows how.
The Chilkat.SysUtil class is free.
// If displayFlags = 0, no print dialog is shown.
// If displayFlags = 1, a print dialog is shown and the user may
// select a printer and settings.
int displayFlags = 0;
string filename = "myReport.pdf";
string operation = "print";
string param = null;
string cwd = System.IO.Directory.GetCurrentDirectory();
// Send the file to the default printer.
Chilkat.SysUtil sysUtil = new Chilkat.SysUtil();
bool success = sysUtil.ShellExecuteW(operation, filename, param, cwd, displayFlags);
if (success)
{
MessageBox.Show("Success.");
}
else
{
MessageBox.Show("Failed.");
}
/* Full set of displayFlags for ShellExecuteW:
#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_SHOWDEFAULT 10
#define SW_FORCEMINIMIZE 11
#define SW_MAX 11
*/