Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool Print(PDocument pDocument)
- {
- if (File.Exists(pDocument.FilePath))
- using (var pdfDoc = PdfDocument.Load(pDocument.FilePath))
- {
- using (var printDoc = pdfDoc.CreatePrintDocument())
- {
- printDoc.PrinterSettings = pDocument.PrinterSettings;
- int copies = Int32.Parse(pDocument.copiesCount);
- printDoc.PrinterSettings.Copies = (short)copies;
- printDoc.DocumentName = pDocument.FileName;
- printDoc.Print();
- return true;
- }
- }
- return false;
- }
- BinaryFormatter binFormat = new BinaryFormatter();
- using (FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate))
- {
- PrinterSettings printerSettings = (PrinterSettings)binFormat.Deserialize(fs);
- return printerSettings;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement