Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Printing the pdf file using process.start print opens the pdf file

$
0
0

Hi,

I write the following code to print the pdf file.

-----------------------------------------------------------

               var printerSettings                        = new PrinterSettings();
                process                                        = new Process();
                process.StartInfo.FileName          = FileToPrint;// pdf file to print
                //print to specified printer
                process.StartInfo.Verb                          = "PrintTo";
                process.StartInfo.CreateNoWindow     = true;

                process.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;              

                //Printer name
                process.StartInfo.Arguments                = printerSettings.PrinterName;
                process.Start();
                process.WaitForExit();

-------------------------------------------------------------------

It prints the file but it open the file first and then print it.

But I want the process should print it without opening any document.

any idea?

Thanks in advance.



Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>