我有以下代碼:打印PDF文件與PDFSharp
using System;
using System.Diagnostics;
using System.IO;
using PdfSharp.Pdf.Printing;
namespace PrintPdfFile
{
class Program
{
[STAThread]
static void Main(string[] args)
{
// Set Acrobat Reader EXE, e.g.:
PdfFilePrinter.AdobeReaderPath = @"C:\\Documents and Settings\\mike.smith\\Desktop\\Adobe Reader 9.0.exe";
// -or-
//PdfPrinter.AdobeReaderPath = @"C:\Program Files\Adobe\[...]\AcroRd32.exe";
//// Ony my computer (running a German version of Windows XP) it is here:
//PdfFilePrinter.AdobeReaderPath = @"C:\\Documents and Settings\\mike.smith\\Desktop\\Adobe Reader 9.0.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(@"C:\Documents and Settings\mike.smith\Desktop\Stuff\ReleaseNotesAndFolderList.pdf", " \\ny-dc-03\\IT-01");
try
{
printer.Print();
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
}
}
對於我的生活,我不能得到這個工作,並打印出一個單一的PDF文件。任何時候我去打印,我收到錯誤「找不到指定的文件」。有人有任何想法,如果我的代碼有問題?我使用PDFSharp這裏...
其中是PDFSharp.PDF.Printing命名空間? – nuander 2016-03-16 23:20:12
ahhh在當前版本的PDFSharp中,整個印刷類被註釋掉 – nuander 2016-03-17 19:48:25