SHARE
TWEET

Untitled

a guest Jun 25th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static bool Print(PDocument pDocument)
  2. {
  3.     if (File.Exists(pDocument.FilePath))
  4.     using (var pdfDoc = PdfDocument.Load(pDocument.FilePath))
  5.     {
  6.         using (var printDoc = pdfDoc.CreatePrintDocument())
  7.         {
  8.             printDoc.PrinterSettings = pDocument.PrinterSettings;
  9.             int copies = Int32.Parse(pDocument.copiesCount);
  10.             printDoc.PrinterSettings.Copies = (short)copies;
  11.             printDoc.DocumentName = pDocument.FileName;
  12.             printDoc.Print();
  13.             return true;
  14.         }
  15.     }
  16.     return false;
  17. }
  18.      
  19. BinaryFormatter binFormat = new BinaryFormatter();
  20. using (FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate))
  21. {
  22.     PrinterSettings printerSettings = (PrinterSettings)binFormat.Deserialize(fs);
  23.     return printerSettings;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top