Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- byte[] bytes = Convert.FromBase64String(content);
- File.WriteAllBytes(path, bytes);
- this.debug(adobePath);
- this.debug(path);
- var isLocked = true;
- /*while (isLocked)
- {
- try{
- File.ReadAllBytes(path);
- isLocked = false;
- this.debug("FILE IS FREED");
- }
- catch(Exception)
- {
- this.debug("SLEEP");
- Thread.Sleep(50);
- }
- }*/
- Process process = new Process();
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.FileName = adobePath;
- process.StartInfo.Arguments = string.Format("/t {0} "{1}"", path, printerName);
- process.StartInfo.CreateNoWindow = true;
- process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
- process.Start();
- // Stops here without printing the file
- process.WaitForExit();
- if (!process.HasExited)
- {
- process.WaitForInputIdle();
- process.CloseMainWindow();
- process.Kill();
- }
- this.debug("FINISH");
- }
- catch (Exception ex)
- {
- this.debug(ex.Message);
- }
- if (File.Exists(path))
- {
- File.Delete(path);
- }
Add Comment
Please, Sign In to add comment