Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public void Print( OtherDoc otherDoc )
  2. {
  3. try
  4. {
  5. using ( FileStream sourceFile = new FileStream( otherDoc.Uri, FileMode.Open, FileAccess.ReadWrite, FileShare.None ) )
  6. {
  7. var pdfDoc = new PDF.Document(sourceFile, otherDoc.Password);
  8.  
  9. this.PrintDoc( pdfDoc );
  10. }
  11.  
  12. this.PrintResult = PdfPrintResult.Success;
  13. }
  14. catch ( System.UnauthorizedAccessException )
  15. {
  16. this.PrintResult = PdfPrintResult.EditFail;
  17. }
  18. catch ( System.Exception e )
  19. {
  20. this.PrintResult = PdfPrintResult.GeneralFail;
  21. this.PrintError = e.Message;
  22. }
  23. }
  24.  
  25.  
  26. private void PrintDoc( PDF.Document pdfDoc )
  27. {
  28. PDF.Printing.PrintSettings printSettings = new PDF.Printing.PrintSettings();
  29. pdfDoc.Print( printSettings );
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement