このコードを使用して、動作しているドライブ D: から myDocument.pdf ファイルを印刷しています。
Process proc = new Process();
proc.StartInfo.Verb = "PrinTo";
proc.StartInfo.FileName = @"C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe";
proc.StartInfo.Arguments = @"/p /h D:myDocument.pdf";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForInputIdle();
System.Threading.Thread.Sleep(1000);
if (false == proc.CloseMainWindow())
proc.Kill();
しかし、Content/report/myDocument.pdf であるプロジェクト内のフォルダーからファイルを印刷したいと考えています。「proc.StartInfo.Arguments = @"/p /h D:myDocument.pdf";」を変更しようとしました。に:
proc.StartInfo.Arguments = Server.MapPath("~/Content/report/myDocument.pdf");
proc.StartInfo.Arguments = @"Content/report/myDocument.pdf";
proc.StartInfo.Arguments "C:\Users\User\Documents\Visual Studio 2012\Projects\PDF\PDF\Content\report\myDocument.pdf";
そのすべてが機能しておらず、Adobe Reader はファイルが見つからないと言っています。
注: Adobe ReaderがmyDocument.pdfファイルを見つけるかどうかを試すためだけに、Adobe Readerを印刷して最小化するコマンドである「/ p / h」を削除しました。
私のパスで何が間違っていますか?前もって感謝します。