Browse Source

Removed Print Button from PDFViewer control

Frank van den Bos 2 năm trước cách đây
mục cha
commit
200e7c60f6

+ 1 - 1
InABox.DynamicGrid/DynamicDocumentGrid.cs

@@ -79,7 +79,7 @@ namespace InABox.DynamicGrid
             {
                 var viewer = new DocumentEditor(row.ToObject<TDocument>());
                 viewer.Watermark = OnGetWaterMark?.Invoke(row);
-                viewer.PrintAllowed = true;
+                //viewer.PrintAllowed = true;
                 viewer.SaveAllowed = true;
                 viewer.ShowDialog();
             }

+ 3 - 3
InABox.DynamicGrid/PDF/DocumentEditor.xaml.cs

@@ -17,7 +17,7 @@ namespace InABox.DynamicGrid
 
         public DocumentEditor(params IEntityDocument[] documents)
         {
-            PrintAllowed = false;
+            //PrintAllowed = false;
             SaveAllowed = false;
             InitializeComponent();
             _documents = documents;
@@ -34,7 +34,7 @@ namespace InABox.DynamicGrid
             Documents.SelectedIndex = -1;
         }
 
-        public bool PrintAllowed { get; set; }
+        //public bool PrintAllowed { get; set; }
         public bool SaveAllowed { get; set; }
         public string Watermark { get; set; }
 
@@ -70,7 +70,7 @@ namespace InABox.DynamicGrid
                         if (extension.Equals(".pdf"))
                         {
                             var pdf = new PDFEditorControl();
-                            pdf.PrintAllowed = PrintAllowed;
+                            //pdf.PrintAllowed = PrintAllowed;
                             pdf.SaveAllowed = SaveAllowed;
                             pdf.Watermark = Watermark;
                             editor = pdf;

+ 12 - 2
InABox.DynamicGrid/PDF/PDFEditorControl.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.IO;
@@ -51,7 +52,7 @@ namespace InABox.DynamicGrid
         public string LineColor { get; set; }
         public int TextSize { get; set; }
 
-        public bool PrintAllowed { get; set; }
+        //public bool PrintAllowed { get; set; }
 
         public bool SaveAllowed { get; set; }
 
@@ -591,7 +592,7 @@ namespace InABox.DynamicGrid
 
             PdfSizeImage.Source = SizeBitmap().AsBitmapImage(32, 32, false);
 
-            PdfPrint.Visibility = PrintAllowed ? Visibility.Visible : Visibility.Collapsed;
+            PdfPrint.Visibility = Visibility.Collapsed; //PrintAllowed ? Visibility.Visible : Visibility.Collapsed;
             PdfSave.Visibility = SaveAllowed ? Visibility.Visible : Visibility.Collapsed;
 
             ColorButton(PdfNoneImage, selected, Properties.Resources.hand);
@@ -662,6 +663,15 @@ namespace InABox.DynamicGrid
                 data = FlattenPdf(data);
                 var filename = dlg.FileName;
                 File.WriteAllBytes(filename, data);
+                
+                var gsProcessInfo = new ProcessStartInfo();
+                gsProcessInfo.Verb = "open";
+                gsProcessInfo.WindowStyle = ProcessWindowStyle.Normal;
+                gsProcessInfo.FileName = filename;
+                gsProcessInfo.UseShellExecute = true;
+
+                Process.Start(gsProcessInfo);
+                
             }
         }