I am using this code to print myDocument.pdf file from drive D: which is working.
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();
But i want to print a file from the folder inside my project which is Content/report/myDocument.pdf. i have tried to change 'proc.StartInfo.Arguments = @"/p /h D:myDocument.pdf";' to:
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";
All of that are not working and adobe reader says that the file cannot be found.
Note: I removed "/p /h" which is the command to print and minimize adobe reader just to try if adobe reader will find the myDocument.pdf file.
What is wrong in my paths? Thanks in advance.