簡體   English   中英

即使CreateNoWindow為true,PdfFilePrinter.Print仍會啟動Adobe Acrobat閱讀器

[英]PdfFilePrinter.Print still launches the Adobe Acrobat reader even if CreateNoWindow is true

不知何故,使用Adobe Acrobat X,PdfFilePrinter無法阻止Adobe靜默打印PDF頁面。

這是我的代碼:

PdfFilePrinter.AdobeReaderPath = PDFExecPath;
var printer = new PdfFilePrinter(this.documentPath, this.printer);
printer.Print();

這是PdfSharp的來源:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = PdfFilePrinter.adobeReaderPath;
string args = String.Format("/t \"{0}\" \"{1}\"", this.pdfFileName, this.printerName);
//Debug.WriteLine(args);
startInfo.Arguments = args;
startInfo.CreateNoWindow = true;
startInfo.ErrorDialog = false;
startInfo.UseShellExecute = false;
if (this.workingDirectory != null && this.workingDirectory.Length != 0)
  startInfo.WorkingDirectory = this.workingDirectory;

解決了:

PdfFilePrinter.AdobeReaderPath = PDFExecPath;
var printer = new PdfFilePrinter(this.documentPath, this.printer);
printer.Print(1000);

Print(int milliseconds)重載會導致adobe acrobat程序失效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM