PdfFilePrinter.Print по-прежнему запускает программу чтения Adobe Acrobat, даже если CreateNoWindow имеет значение true - PullRequest
0 голосов
/ 24 июня 2011

каким-то образом, с помощью 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;

1 Ответ

2 голосов
/ 24 июня 2011

решено:

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

Перегрузка Print (целые миллисекунды) убивает программу Adobe Acrobat.

...