c# - not able to send documents to printer -


        static void main(string[] args)         {              string fname = "d:\\invoice\\abc.pdf";              sendtoprinter(fname);         }         private static void sendtoprinter(string fname)         {             if (file.exists(fname))             {                 string printeraddress = "***";                 processstartinfo info = new processstartinfo();                 info.verb = "print";                 info.filename = @"c:\program files (x86)\adobe\reader 10.0\reader\acrord32.exe";                 if (!file.exists(@"c:\program files (x86)\adobe\reader 10.0\reader\acrord32.exe"))                 {                     console.writeline("file not found");                  }                 info.createnowindow = true;                 info.windowstyle = processwindowstyle.hidden;                 info.arguments = "\"" + printeraddress + "\"";                  process p = new process();                 p.startinfo = info;                 p.startinfo.errordialog = true;                 p.start();                  p.waitforinputidle();                 system.threading.thread.sleep(3000);                 if (false == p.closemainwindow())                     p.kill();             }             else             {                 console.writeline("no file found");             }         } 

i have written above code print pdf file. gives opens adobe reader , gives error >"the file doesnot have program associated performing action. please install program, if installed, create association in default programs in control panel". returns program , gives ecxeption @ p.start() >"no application associated specified file operation".

in control panel default program .pdf files set same exe i.e adobe reader , have explicitly checked default program particular pdf file in folder trying print.

can me on this. thank sparing time :)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -