Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. saveReportPdf.Filter = "PDF Files|*.pdf";
  2. try
  3. {
  4. string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+"\\RentCarAppLast desktop\\printInvoice.pdf";
  5. saveReportPdf.FileName = path;
  6. doc = new Document();
  7. string nameFile = saveReportPdf.FileName;// + " NO-" + rentIdTxt.Text;
  8. PdfWriter.GetInstance(doc, new FileStream(nameFile, FileMode.Create));
  9. doc.Open();
  10. FillTaxInvoiceParameters();
  11. CreatePdfInvoice();
  12. doc.Close();
  13. Process p = new Process();
  14. p.StartInfo = new ProcessStartInfo()
  15. {
  16. //CreateNoWindow = true,
  17. FileName = path,
  18. Verb = "printto",
  19. Arguments = "\"" + "printerName" + "\"",
  20. //UseShellExecute = true,
  21.  
  22. };
  23.  
  24. p.Start();
  25. //Thread.Sleep(1000);
  26. p.WaitForInputIdle();
  27. p.Kill();
  28. }
  29. catch (IOException IO)
  30. {
  31. MessageBox.Show(IO.Message, "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement