c# - Get PDF Printout from console application programatically in background -
how can printout of pdf file printer programatically? printout command should execute without additional dialog popping up.
i'm using console application , need without using 3rd party library or tool
along lines of @freelancer wrote, use following method uses adobe's registry settings find path acrobat reader executable, prints silently default printer:
private void printpdf(string filename) { var hkeylocalmachine = registry.localmachine.opensubkey(@"software\classes\software\adobe\acrobat"); if (hkeylocalmachine != null) { var exe = hkeylocalmachine.opensubkey("exe"); if (exe != null) { var acrobatpath = exe.getvalue(null).tostring(); if (!string.isnullorempty(acrobatpath)) { var process = new process { startinfo = { useshellexecute = false, filename = acrobatpath, arguments = string.format(cultureinfo.currentculture, "/t {0}", filename) } }; process.start(); } } } }
Comments
Post a Comment