Print Pdf in C# [closed]
A very straight forward approach is to use an installed Adobe Reader or any other PDF viewer capable of printing:
Process p = new Process( );
p.StartInfo = new ProcessStartInfo( )
{
CreateNoWindow = true,
Verb = "print",
FileName = path //put the correct path here
};
p.Start( );
Another way is to use a third party component, e.g. PDFView4NET
I wrote a little helper method around the adobereader to bulk-print pdf from c#...:
public static bool Print(string file, string printer) {
try {
Process.Start(
Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion" +
@"\App Paths\AcroRd32.exe").GetValue("").ToString(),
string.Format("/h /t \"{0}\" \"{1}\"", file, printer));
return true;
} catch { }
return false;
}
One cannot rely on the return-value of the method btw...