CodeAs follows:
Process print = new process ();
Print. startinfo. filename = "C: \ c.pdf"; // path of the PDF file to be printed
Print. startinfo. verb = "print ";
Print. startinfo. Arguments = "\" Maid \ ""; // printer name
Print. startinfo. windowstyle = processwindowstyle. hidden;
Print. startinfo. createnowindow = true;
Print. Start ();
Note: (msdn)
StartinfoA group of parameters used to start a process. CallStart,StartinfoUsed to specify the process to start. UniqueStartinfoThe Member isFilenameAttribute. By specifyingFilenameProperties to start the process. This is similar to typing information in the "run" dialog box in the Windows "start" menu. Therefore,FilenameProperties do not need to indicate executable files. It can be an application whose extension has been installed with the system.ProgramAny associated file type. For example, if you have associated a text file with an editor (such as NotePad ),FilenameIt can have a. txt extension. If you have associated A. DOC file with a word processing tool (such as Microsoft Word), it can have a. Doc extension. Similarly, the "run" dialog box can accept executable file names with or without. EXE extension names in the same way.FilenameMembers are optional. For exampleFilenameSet "notepad.exe" or "Notepad" to "Notepad ".
If the file name involves an unexecutable file (such as a. DOC file), you can include a predicate to specify the operations to perform on the file. For example, for a file ending with a. Doc extensionVerbSet to "print ". If you manuallyVerbEnter a value for the propertyFilenameThe file name specified in the property does not need to have an extension. However, if you useVerbsTo determine which predicates are available, the file extension must be included.
Until it is called on the ProcessStartMethod can be changedStartinfoAttribute. After the process is startedStartinfoValue does not affect or restart the associated process. IfProcessstartinfo. UsernameAndProcessstartinfo. PasswordCalled after attributeStart (processstartinfo)Method To CallCreateprocesswithlogonwFunction.CreatenowindowThe property value isTrueOrWindowstyleThe property value isHiddenThe process will also be started in a new window.
If notStartMethod to start the processStartinfoThe attribute does not reflect the parameters used to start the process. For exampleGetprocessesReturns an array of processes running on a computer.ProcessOfStartinfoThe attribute does not contain the name or parameter of the original file used to start the process.
After the process is started, the file name is filled (read-only)MainmoduleAttribute file. If you want to retrieve the executable files associated with the process after the process starts, useMainmoduleAttribute. If you want to setProcessThe executable file of the instance. UseStartinfoAttributeFilenameMember. BecauseStartinfoThe members of the attribute are to be passed to the process.StartMethod parameter.FilenameProperty is not resetMainmoduleAttribute. These attributes are only used to initialize associated processes.