---
title: "Find A Bug While Printing PDF Files Using Process"  
description: "Find A Bug While Printing PDF Files Using Process"  
author: "CHAITANYA KIRAN KASANI"  
published: 2012-12-01  
updated: 2012-12-01  
canonical: https://www.mindstick.com/forum/478/find-a-bug-while-printing-pdf-files-using-process  
category: "c#"  
tags: ["c#"]  
reading_time: 3 minutes  

---

# Find A Bug While Printing PDF Files Using Process

The Below Is My [Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) Snippet to [Print](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) PDFs From Different FoldersHere It Is [Printing](https://www.mindstick.com/blog/63804/5-ways-you-can-use-printing-in-your-marketing-strategy) One [Path](https://www.mindstick.com/articles/44333/4-expert-tips-on-how-to-pick-the-right-career-path) [PDF File](https://www.mindstick.com/forum/572/pdf-file-download-in-zip-file-in-mvc-4) and Leaving Another Path PDF File To Print..But While in [Debug Mode](https://www.mindstick.com/interview/23356/how-can-you-test-bundling-in-debug-mode) It Is Printing All The [PDF Files](https://answers.mindstick.com/qa/94935/why-does-chrome-on-android-not-open-pdf-files-like-chrome-on-windows-linux-can) Successfully.pls Some One Help Me...\

```
  private void btnPrint_Click(object sender, EventArgs e)  {string path1= method1();//it is string method that returns stringstring path2= method2();string path3= method3();string path4= method4();//Here method1(),method2()...method6() are string methods That returns string.Each String Have Different File Path string[] files = { path1,path2,path3,path4 };                 foreach (string file in files)                {                    PrintPDFs(file);                                   }  }public static Boolean PrintPDFs(string pdfFileName)        {            try            {                Process proc = new Process();                proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;                proc.StartInfo.Verb = "print";                //Get application path will get default application for given file type ("pdf")                //This will allow you to not care if its adobe reader 10 or adobe acrobat.                               proc.StartInfo.FileName = "C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRd32";                proc.StartInfo.Arguments = String.Format(@"/p /h {0}", pdfFileName);                proc.StartInfo.UseShellExecute = false;                proc.StartInfo.CreateNoWindow = true;                proc.Start();                proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;                if (proc.HasExited == false)                {                    proc.WaitForExit(10000);                }                proc.EnableRaisingEvents = true;                proc.Close();                FindAndKillProcess("AcroRd32");                return true;            }            catch            {                return false;            }        }        public static bool FindAndKillProcess(string name)        {            foreach (Process clsProcess in Process.GetProcesses())            {                if (clsProcess.ProcessName.StartsWith(name))                {                    clsProcess.Kill();                    return true;                }            }            return false;        }
```

\
\


---

Original Source: https://www.mindstick.com/forum/478/find-a-bug-while-printing-pdf-files-using-process

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
