private void PrintPDF(string fileName) { // On my computer (running Windows Vista 64) it is here: PdfFilePrinter.AdobeReaderPath = @"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"; // Set the file to print and the Windows name of the printer. // At my home office I have an old Laserjet 6L under my desk. PdfFilePrinter printer = new PdfFilePrinter(fileName, "激光"); printer.Print(); }
static void Main() { // Set Acrobat Reader EXE, e.g.: //PdfPrinter.AdobeReaderPath = @"C:\Program Files\Adobe\Adobe Acrobat 7.0\Acrobat\Acrobat.exe"; // -or- //PdfPrinter.AdobeReaderPath = @"C:\Program Files\Adobe\[...]\AcroRd32.exe"; // On my computer (running Windows Vista 64) it is here: PdfFilePrinter.AdobeReaderPath = @"C:\Program Files (x86)\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe"; // Set the file to print and the Windows name of the printer. // At my home office I have an old Laserjet 6L under my desk. PdfFilePrinter printer = new PdfFilePrinter(@"..\..\..\..\..\PDFS\HelloWorld.pdf", "HP LaserJet 6L"); try { printer.Print(); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }