

Using (Process process = Process.Start(processStartInfo)) ProcessStartInfo processStartInfo = new ProcessStartInfo(_exe.FullName, arguments) Public bool Print(FileInfo file, string printerName) _tempFileForExe = tempFileForExe ? throw new ArgumentNullException(nameof(tempFileForExe)) īyte bytes = Public SumatraWrapper(FileInfo tempFileForExe)

Private readonly FileInfo _tempFileForExe = null If you want to print to a network printer, use the name that appears in Windows print dialogs, like this (and be careful to note the two backslashes at the start of the name and the single backslash after the servername): PDFtoPrinter.exe filename.pdf "\\SERVER\PrinterName"ġ) Download SumatraPDF (portable version) - Ģ) Create a class library project and unzip the SumatraPDF.exe to the project directory root and unblock it.ģ) Inside the project Properties, go to the Resoruces tab and add the exe as a file.Ĥ) Add the following class to your library: public class SumatraWrapper : IDisposable To print to a specific printer, add the name of the printer in quotation marks: PDFtoPrinter.exe filename.pdf "Name of Printer" To print a PDF file to the default Windows printer, use this command: PDFtoPrinter.exe filename.pdf The program is designed generally for the Windows command line and also for use with the vDos DOS emulator.

PDFtoPrinter is a program for printing PDF files from the Windows command line. It's a simple exe that you call with the filename and it prints to the default printer (or one that you specify).
