Quellcode durchsuchen

ComPDFKit.Demo(win) - 优化打印功能

liuaoran vor 6 Monaten
Ursprung
Commit
0d7ce654df

+ 131 - 27
Demo/Examples/Compdfkit.Controls/Printer/PrintHelper.cs

@@ -24,10 +24,7 @@ namespace ComPDFKit.Controls.Printer
 
     public static class PrintHelper
     {
-
-        public static readonly PrintServer printServer = new PrintServer();
         private static PrintSettingsInfo printSettingsInfo;
-        private static PrintQueue printQueue;
         private static int MaxCopies = 1;
         private static bool FinishedFrontSide = false;
         private static bool isManualDuplex = false;
@@ -36,17 +33,34 @@ namespace ComPDFKit.Controls.Printer
         private static Bitmap blankPageBitmapForPrint;
         private static int PrintIndex;
 
+        public static PrintQueue printQueue;
+
+        public static void InitPrint()
+        {
+            MaxCopies = 1;
+            FinishedFrontSide = false;
+            isManualDuplex = false;
+            outputColors = new List<OutputColor>();
+            duplexings = new List<Duplexing>();
+            blankPageBitmapForPrint = null;
+            PrintIndex = 0;
+        }
+
         private static void SetPrinterLimits()
         {
             MaxCopies = printQueue.GetPrintCapabilities().MaxCopyCount.HasValue ? printQueue.GetPrintCapabilities().MaxCopyCount.Value : 1;
             outputColors = new List<OutputColor>(printQueue.GetPrintCapabilities().OutputColorCapability);
             duplexings = new List<Duplexing>(printQueue.GetPrintCapabilities().DuplexingCapability);
         }
+         
+        public static PrintQueue GetPrintQueue(PrintServer server, string printerName)
+        {
+            return server.GetPrintQueue(printerName);
+        }
 
         public static void PrintDocument(PrintSettingsInfo printSettings)
-        {
-            printSettingsInfo = printSettings;
-            printQueue = printServer.GetPrintQueue(printSettings.PrinterName);
+        { 
+            printSettingsInfo = printSettings; 
 
             SetPrinterLimits();
 
@@ -73,8 +87,8 @@ namespace ComPDFKit.Controls.Printer
                         HandlePrintQueue(DuplexingStage.FontSide);
                         if (FinishedFrontSide)
                         {
-                            DialogResult dialogResult = MessageBox.Show("Do you want to print the back side?", "Print", MessageBoxButtons.YesNo);
-                            if (dialogResult == DialogResult.OK)
+                            DialogResult dialogResult = MessageBox.Show("Print the back side.", "Print", MessageBoxButtons.YesNo);
+                            if (dialogResult == DialogResult.Yes)
                             {
                                 HandlePrintQueue(DuplexingStage.BackSide);
                             }
@@ -101,14 +115,24 @@ namespace ComPDFKit.Controls.Printer
                     var printTicket = new PrintTicket();
 
                     printDocument.PrinterSettings.PrinterName = printQueue.Name;
-
+                      
                     printDocument.DefaultPageSettings.Color = !printSettingsInfo.IsGrayscale && outputColors.Contains(OutputColor.Color);
 
+                    printTicket.PageOrientation = printSettingsInfo.PrintOrientation;
+                      
                     if (printSettingsInfo.DuplexPrintMod > 0 || printSettingsInfo.PrintMode is BookletModeInfo)
                     {
                         if (stage == DuplexingStage.None)
                         {
-                            printDocument.DefaultPageSettings.Landscape = (printSettingsInfo.PrintOrientation == PrintOrientation.Landscape);
+                            if (printSettingsInfo.DuplexPrintMod == DuplexPrintMod.FlipLongEdge)
+                            {
+                                printDocument.PrinterSettings.Duplex = Duplex.Horizontal;
+                            }
+                            else
+                            {
+                                printDocument.PrinterSettings.Duplex = Duplex.Vertical; 
+                            }
+                            PrintIndex = 0;
                         }
                         else
                         {
@@ -120,15 +144,26 @@ namespace ComPDFKit.Controls.Printer
                     else
                     {
                         printDocument.PrinterSettings.Duplex = Duplex.Simplex;
+                        PrintIndex = 0;
                     }
 
                     printQueue.DefaultPrintTicket = printTicket;
                     printDocument.DefaultPageSettings.PaperSize = printSettingsInfo.PaperSize;
+                    printDocument.DefaultPageSettings.Landscape = (printSettingsInfo.PrintOrientation == PageOrientation.Landscape);
+                    List<PaperSource> paperSources;
+                    if (printDocument.PrinterSettings.PaperSources.Count > 0)
+                    {
+                        paperSources = Enumerable.Range(0, printDocument.PrinterSettings.PaperSources.Count).
+    Select(i => printDocument.PrinterSettings.PaperSources[i]).ToList();
+                    }
+                    else
+                    {
+                        PaperSource defaultPaperSource = new PaperSource();
+                        defaultPaperSource.SourceName = "Default";
+                        paperSources = new List<PaperSource> { defaultPaperSource };
+                    }
 
-                    List<PaperSource> paperSources = Enumerable.Range(0, printDocument.PrinterSettings.PaperSources.Count).
-                        Select(i => printDocument.PrinterSettings.PaperSources[i]).ToList();
-                    printDocument.DefaultPageSettings.Margins = printSettingsInfo.Margins;
-                    printDocument.DefaultPageSettings.PaperSource = paperSources.FirstOrDefault();
+                    printDocument.DefaultPageSettings.Margins = new Margins() { Left = (int)printSettingsInfo.Margins.Left, Bottom = (int)printSettingsInfo.Margins.Bottom, Right = (int)printSettingsInfo.Margins.Right, Top = (int)printSettingsInfo.Margins.Top};
                     if (printSettingsInfo.Copies >= printQueue.GetPrintCapabilities().MaxCopyCount)
                     {
                         printDocument.PrinterSettings.Copies = (short)MaxCopies;
@@ -138,6 +173,7 @@ namespace ComPDFKit.Controls.Printer
                         printDocument.PrinterSettings.Copies = (short)printSettingsInfo.Copies;
                     }
 
+                    printDocument.PrintPage -= PrintDocument_PrintPage;
                     printDocument.PrintPage += PrintDocument_PrintPage;
 
                     printDocument.PrinterSettings.PrintFileName = printSettingsInfo.Document.FileName;
@@ -145,11 +181,16 @@ namespace ComPDFKit.Controls.Printer
                     try
                     {
                         printDocument.Print();
+                        if(stage == DuplexingStage.FontSide)
+                        {
+                            FinishedFrontSide = true;
+                        }
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show(ex.Message);
                     }
+
                 }
             }
         }
@@ -275,8 +316,14 @@ namespace ComPDFKit.Controls.Printer
 
             if (printSettingsInfo.PrintMode is SizeModeInfo sizeMode)
             {
-                CPDFPage page = printSettingsInfo.Document.PageAtIndex(printSettingsInfo.PageRangeList[PrintIndex]);
+                CPDFPage page = printSettingsInfo.Document.PageAtIndex(printSettingsInfo.TargetPaperList[PrintIndex]);
                 Rectangle realBound = e.PageBounds;
+                if (!printSettingsInfo.IsBorderless)
+                {
+                    realBound.Width = realBound.Width - (int)printSettingsInfo.Margins.Left - (int)printSettingsInfo.Margins.Right;
+                    realBound.Height = realBound.Height - (int)printSettingsInfo.Margins.Top - (int)printSettingsInfo.Margins.Bottom;
+                }
+                Margins margins = e.PageSettings.Margins;
                 Point point = new Point(0, 0);
 
                 if (page != null)
@@ -299,18 +346,34 @@ namespace ComPDFKit.Controls.Printer
                         int resizeHeight;
                         int resizeWidth;
 
-                        if (bitmap.Height / bitmap.Width >= printSettingsInfo.PaperSize.Height / printSettingsInfo.PaperSize.Width)
+                        if (bitmap.Height / bitmap.Width >= (printSettingsInfo.ActualHeight / printSettingsInfo.ActualWidth))
                         {
-                            resizeHeight = printSettingsInfo.PaperSize.Height * heightDpiRatio;
-                            resizeWidth = bitmap.Width * printSettingsInfo.PaperSize.Height / bitmap.Height * widthDpiRatio;
+                            if (printSettingsInfo.PrintOrientation == PageOrientation.Portrait)
+                            {
+                                resizeHeight = (int)printSettingsInfo.ActualHeight;
+                                resizeWidth = (int)(printSettingsInfo.ActualHeight / bitmap.Height * bitmap.Width);
+                            }
+                            else
+                            {
+                                resizeWidth = (int)printSettingsInfo.ActualHeight;
+                                resizeHeight = (int)(printSettingsInfo.ActualHeight / bitmap.Height * bitmap.Width);
+                            }
                         }
                         else
                         {
-                            resizeWidth = printSettingsInfo.PaperSize.Width * widthDpiRatio;
-                            resizeHeight = bitmap.Height * printSettingsInfo.PaperSize.Width / bitmap.Width * heightDpiRatio;
+                            if (printSettingsInfo.PrintOrientation == PageOrientation.Portrait)
+                            {
+                                resizeWidth = (int)printSettingsInfo.ActualWidth;
+                                resizeHeight = (int)(printSettingsInfo.ActualWidth / bitmap.Width * bitmap.Height);
+                            }
+                            else
+                            {
+                                resizeHeight = (int)printSettingsInfo.ActualWidth;
+                                resizeWidth = (int)(printSettingsInfo.ActualWidth / bitmap.Height * bitmap.Width);
+                            }
                         }
 
-                        using (Bitmap resizedBitmap = new Bitmap(bitmap, resizeWidth, resizeHeight))
+                        using (Bitmap resizedBitmap = new Bitmap(bitmap, resizeWidth * widthDpiRatio, resizeHeight * heightDpiRatio))
                         {
                             if (isManualDuplex && PrintIndex % 2 == 1 && printSettingsInfo.DuplexPrintMod == DuplexPrintMod.FlipShortEdge)
                             {
@@ -330,7 +393,23 @@ namespace ComPDFKit.Controls.Printer
                                     realBound.Width = (int)(realBound.Height * aspectRatioResizedBitmap);
                                 }
                             }
-                            e.Graphics.DrawImage(resizedBitmap, realBound, new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
+
+                            int originX = (e.PageBounds.Width - realBound.Width)/2;
+                            int originY = (e.PageBounds.Height - realBound.Height)/2;
+                            if (!printSettingsInfo.IsBorderless)
+                            {
+                                if (originX < printSettingsInfo.Margins.Left)
+                                {
+                                    originX = (int)printSettingsInfo.Margins.Left;
+                                }
+
+                                if (originY < printSettingsInfo.Margins.Top)
+                                {
+                                    originY = (int)printSettingsInfo.Margins.Top;
+                                }
+                            } 
+
+                            e.Graphics.DrawImage(resizedBitmap, new Rectangle(originX, originY, realBound.Width, realBound.Height), new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
                         }
                     }
                     else if (sizeMode.SizeType == SizeType.Actural)
@@ -355,7 +434,21 @@ namespace ComPDFKit.Controls.Printer
                                     realBound.Width = (int)(realBound.Height * aspectRatioResizedBitmap);
                                 }
                             }
-                            e.Graphics.DrawImage(resizedBitmap, realBound, new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
+                            int originX = (e.PageBounds.Width - realBound.Width) / 2;
+                            int originY = (e.PageBounds.Height - realBound.Height) / 2;
+                            if (!printSettingsInfo.IsBorderless)
+                            {
+                                if (originX < printSettingsInfo.Margins.Left)
+                                {
+                                    originX = (int)printSettingsInfo.Margins.Left;
+                                }
+
+                                if (originY < printSettingsInfo.Margins.Top)
+                                {
+                                    originY = (int)printSettingsInfo.Margins.Top;
+                                }
+                            } 
+                            e.Graphics.DrawImage(resizedBitmap, new Rectangle(originX, originY, realBound.Width, realBound.Height), new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
                         }
                     }
                     else if (sizeMode.SizeType == SizeType.Customized)
@@ -384,10 +477,21 @@ namespace ComPDFKit.Controls.Printer
                                 }
                             }
 
-                            realBound.X = (e.PageBounds.Width - realBound.Width) / 2;
-                            realBound.Y = (e.PageBounds.Height - realBound.Height) / 2;
+                            int originX = (e.PageBounds.Width - realBound.Width) / 2;
+                            int originY = (e.PageBounds.Height - realBound.Height) / 2;
+                            if (!printSettingsInfo.IsBorderless)
+                            {
+                                if (originX < printSettingsInfo.Margins.Left)
+                                {
+                                    originX = (int)printSettingsInfo.Margins.Left;
+                                }
 
-                            e.Graphics.DrawImage(resizedBitmap, realBound,  new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
+                                if (originY < printSettingsInfo.Margins.Top)
+                                {
+                                    originY = (int)printSettingsInfo.Margins.Top;
+                                }
+                            }
+                            e.Graphics.DrawImage(resizedBitmap, new Rectangle(originX, originY, realBound.Width, realBound.Height),  new Rectangle(0, 0, resizedBitmap.Width, resizedBitmap.Height), GraphicsUnit.Pixel);
                         }
                     }
 
@@ -419,7 +523,7 @@ namespace ComPDFKit.Controls.Printer
                         }
                         else
                         {
-                            e.HasMorePages = false;
+                            e.HasMorePages = false;  
                         }
                     }
                 }

+ 7 - 7
Demo/Examples/Compdfkit.Controls/Printer/PrintPreviewControl.xaml

@@ -95,15 +95,15 @@
             <TextBlock Text="{Binding PaperHeight}"></TextBlock>
         </StackPanel> 
         <Grid Grid.Row="1" Margin="5">
-            <Viewbox Height="{Binding ViewBoxHeight}" Width="{Binding ViewBoxWidth}">
-                <Image Name="imgPrint" RenderOptions.BitmapScalingMode="HighQuality" Source="{Binding PreviewBitmapSource}"> 
-                </Image>
-            </Viewbox> 
+            <Border BorderThickness="1" BorderBrush="#5a000000" Background="#1a000000" Height="{Binding ViewBoxHeight}" Width="{Binding ViewBoxWidth}"> 
+                <Viewbox>
+                    <Image Name="imgPrint" RenderOptions.BitmapScalingMode="HighQuality" Source="{Binding PreviewBitmapSource}"  Margin="{Binding Margins}">
+                    </Image>
+                </Viewbox>
+            </Border>
         </Grid>
         <StackPanel Grid.Row="2" HorizontalAlignment="Center" Orientation="Horizontal">
-            <Button x:Name="btnPreButton" Height="32" Width="36" Style="{StaticResource PrePageBtnStyle}" Margin="0,0,12,0" Click="btnPreButton_Click">
-                
-            </Button>
+            <Button x:Name="btnPreButton" Height="32" Width="36" Style="{StaticResource PrePageBtnStyle}" Margin="0,0,12,0" Click="btnPreButton_Click"></Button>
             <TextBox x:Name="txbPageIndex" Height="32" Width="50" Text="{Binding PaperIndex, UpdateSourceTrigger=PropertyChanged}" LostFocus="txbPageIndex_LostFocus" PreviewLostKeyboardFocus="txbPageIndex_PreviewLostKeyboardFocus" TextAlignment="Center" VerticalContentAlignment="Center"></TextBox>
             <TextBlock Text=" of " VerticalAlignment="Center"></TextBlock>
             <TextBlock  Text="{Binding PrintedPageCount}"  VerticalAlignment="Center"></TextBlock>

+ 96 - 48
Demo/Examples/Compdfkit.Controls/Printer/PrintPreviewControl.xaml.cs

@@ -1,31 +1,17 @@
 using ComPDFKit.Controls.Printer;
 using ComPDFKit.Import;
 using ComPDFKit.PDFPage;
-using ComPDFKit.Tool.Help;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Drawing;
-using System.Drawing.Imaging;
-using System.IO;
-using System.Linq;
+using System.Printing;
 using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
 using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Xml.Linq;
-using static System.Windows.Forms.AxHost;
 using Color = System.Drawing.Color;
-using Pen = System.Drawing.Pen;
 using Point = System.Drawing.Point;
 using Rectangle = System.Drawing.Rectangle;
 
@@ -40,21 +26,20 @@ namespace ComPDFKit.Controls.PDFControl
         private double mmToDpiRatio = 100 / 25.4;
 
         private PrintSettingsInfo printSettingsInfo;
-        private Bitmap blankPageBitmap;
 
         private int originalPaperIndex;
         private string _paperIndex = "1";
         public string PaperIndex
         {
             get
-            { 
+            {
                 return _paperIndex;
             }
             set
             {
                 if (int.TryParse(value, out int paperIndex))
                 {
-                    if (paperIndex > 0 && paperIndex <= TargetPaperList.Count)
+                    if (paperIndex > 0 && paperIndex <= printSettingsInfo.TargetPaperList.Count)
                     {
                         originalPaperIndex = paperIndex;
                         if (UpdateProper(ref _paperIndex, value))
@@ -123,9 +108,18 @@ namespace ComPDFKit.Controls.PDFControl
             set => UpdateProper(ref _priviewBitmapSource, value);
         }
 
-        public List<int> TargetPaperList = new List<int>();
+        private Thickness _margins;
+        public Thickness Margins
+        {
+            get => _margins;
+            set => UpdateProper(ref _margins, value);
+        }
+
 
         private int _targetPaperIndex = 0;
+
+        private Bitmap blankPageBitmap;
+
         public int TargetPaperIndex
         {
             get => _targetPaperIndex;
@@ -144,31 +138,67 @@ namespace ComPDFKit.Controls.PDFControl
             {
                 ViewBoxHeight = "248.0";
                 ViewBoxWidth = (width / height * 248.0).ToString();
+                Margins = new Thickness()
+                {
+                    Left = printSettingsInfo.Margins.Left * (248.0 / printSettingsInfo.PaperSize.Height),
+                    Right = printSettingsInfo.Margins.Right * (248.0 / printSettingsInfo.PaperSize.Height),
+                    Top = printSettingsInfo.Margins.Top * (248.0 / printSettingsInfo.PaperSize.Height),
+                    Bottom = printSettingsInfo.Margins.Bottom * (248.0 / printSettingsInfo.PaperSize.Height)
+                };
             }
             else
             {
                 ViewBoxWidth = "180.0";
                 ViewBoxHeight = (height / width * 180.0).ToString();
+                Margins = new Thickness()
+                {
+                    Left = printSettingsInfo.Margins.Left * (180.0 / printSettingsInfo.PaperSize.Width),
+                    Right = printSettingsInfo.Margins.Right * (180.0 / printSettingsInfo.PaperSize.Width),
+                    Top = printSettingsInfo.Margins.Top * (180.0 / printSettingsInfo.PaperSize.Width),
+                    Bottom = printSettingsInfo.Margins.Bottom * (180.0 / printSettingsInfo.PaperSize.Width)
+                };
             }
         }
 
         private void SetPreviewBox()
         {
             PaperKind = printSettingsInfo.PaperSize.Kind.ToString();
-            if (printSettingsInfo.PrintOrientation == PrintOrientation.Portrait)
+            if (printSettingsInfo.PrintOrientation == PageOrientation.Portrait)
             {
-                PaperWidth = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Width));
-                PaperHeight = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Height));
+                SetPortrait();
+            }
+            else if (printSettingsInfo.PrintOrientation == PageOrientation.Landscape)
+            {
+                SetLandscape();
             }
             else
             {
-                PaperWidth = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Height));
-                PaperHeight = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Width));
+                CPDFPage page = printSettingsInfo.Document.PageAtIndex(printSettingsInfo.TargetPaperList[TargetPaperIndex]);
+                if (page.PageSize.height > page.PageSize.width)
+                {
+                    SetPortrait();
+                }
+                else
+                {
+                    SetLandscape();
+                }
             }
             if (!(printSettingsInfo.PrintMode is PosterModeInfo))
             {
                 SetViewBox(double.Parse(PaperHeight), double.Parse(PaperWidth));
             }
+
+            void SetPortrait()
+            {
+                PaperWidth = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Width));
+                PaperHeight = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Height));
+            }
+
+            void SetLandscape()
+            {
+                PaperWidth = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Height));
+                PaperHeight = string.Format("{0:F1}", (printSettingsInfo.PaperSize.Width));
+            }
         }
 
         internal void Init(PrintSettingsInfo printSettingsInfo, bool needPageReset = false)
@@ -182,15 +212,18 @@ namespace ComPDFKit.Controls.PDFControl
 
         private void CreateBlankBitmap()
         {
-            int width = printSettingsInfo.PrintOrientation == PrintOrientation.Portrait
-                        ? printSettingsInfo.PaperSize.Width
-                        : printSettingsInfo.PaperSize.Height;
+            CPDFPage page = printSettingsInfo.Document.PageAtIndex(printSettingsInfo.TargetPaperList[TargetPaperIndex]);
+            double height = 0;
+            double width = 0;
+            width = printSettingsInfo.PrintOrientation == PageOrientation.Portrait
+                ? printSettingsInfo.ActualWidth
+                : printSettingsInfo.ActualHeight;
 
-            int height = printSettingsInfo.PrintOrientation == PrintOrientation.Portrait
-                         ? printSettingsInfo.PaperSize.Height
-                         : printSettingsInfo.PaperSize.Width;
+            height = printSettingsInfo.PrintOrientation == PageOrientation.Portrait
+                ? printSettingsInfo.ActualHeight
+                : printSettingsInfo.ActualWidth;
 
-            blankPageBitmap = new Bitmap(width, height);
+            blankPageBitmap = new Bitmap((int)width, (int)height);
 
             using (Graphics g = Graphics.FromImage(blankPageBitmap))
             {
@@ -200,15 +233,15 @@ namespace ComPDFKit.Controls.PDFControl
 
         public void CalculatePaperCollection(bool needPageReset = false)
         {
-            TargetPaperList = new List<int>(printSettingsInfo.PageRangeList);
+            printSettingsInfo.TargetPaperList = new List<int>(printSettingsInfo.PageRangeList);
             if (printSettingsInfo.IsReverseOrder)
             {
-                TargetPaperList.Reverse();
+                printSettingsInfo.TargetPaperList.Reverse();
             }
             if (needPageReset)
             {
                 PaperIndex = "1";
-            } 
+            }
         }
 
         public PrintPreviewControl()
@@ -220,11 +253,10 @@ namespace ComPDFKit.Controls.PDFControl
         private readonly object lockObject = new object();
         private void PaintPageByCurrentPreviewIndex()
         {
-            CreateBlankBitmap();
-            SetPreviewBox();
             lock (lockObject)
             {
-                PreviewPageBySizeMode(TargetPaperList[TargetPaperIndex]);
+                CreateBlankBitmap();
+                PreviewPageBySizeMode(printSettingsInfo.TargetPaperList[TargetPaperIndex]);
             }
         }
 
@@ -288,7 +320,7 @@ namespace ComPDFKit.Controls.PDFControl
 
             if (page != null)
             {
-                page.RenderPageBitmapWithMatrix((float)1, pageRect, 0xFFFFFFFF, bmpData, printSettingsInfo.IsPrintAnnot?1:0, printSettingsInfo.IsPrintForm);
+                page.RenderPageBitmapWithMatrix((float)1, pageRect, 0xFFFFFFFF, bmpData, printSettingsInfo.IsPrintAnnot ? 1 : 0, printSettingsInfo.IsPrintForm);
                 Point startPoint = new Point(0, 0);
 
                 Bitmap bitmap = PrintHelper.BuildBmp((int)pageRect.width(), (int)pageRect.height(), bmpData);
@@ -302,15 +334,31 @@ namespace ComPDFKit.Controls.PDFControl
                 {
                     int resizedHeight = 0;
                     int resizedWidth = 0;
-                    if (bitmap.Height / bitmap.Width >= (float.Parse(PaperHeight) / float.Parse(PaperWidth)))
+                    if (bitmap.Height / bitmap.Width >= (printSettingsInfo.ActualHeight / printSettingsInfo.ActualWidth))
                     {
-                        resizedHeight = (int)(float.Parse(PaperHeight));
-                        resizedWidth = (int)((float.Parse(PaperHeight) / bitmap.Height * bitmap.Width));
+                        if (printSettingsInfo.PrintOrientation == PageOrientation.Portrait)
+                        {
+                            resizedHeight = (int)printSettingsInfo.ActualHeight;
+                            resizedWidth = (int)(printSettingsInfo.ActualHeight / bitmap.Height * bitmap.Width);
+                        }
+                        else
+                        {
+                            resizedWidth = (int)printSettingsInfo.ActualHeight;
+                            resizedHeight = (int)(printSettingsInfo.ActualHeight / bitmap.Height * bitmap.Width);
+                        }
                     }
                     else
                     {
-                        resizedWidth = (int)(float.Parse(PaperWidth));
-                        resizedHeight = (int)((float.Parse(PaperWidth) / bitmap.Width * bitmap.Height));
+                        if (printSettingsInfo.PrintOrientation == PageOrientation.Portrait)
+                        {
+                            resizedWidth = (int)printSettingsInfo.ActualWidth;
+                            resizedHeight = (int)(printSettingsInfo.ActualWidth / bitmap.Width * bitmap.Height);
+                        }
+                        else
+                        {
+                            resizedHeight = (int)printSettingsInfo.ActualWidth;
+                            resizedWidth = (int)(printSettingsInfo.ActualWidth / bitmap.Height * bitmap.Width);
+                        }
                     }
 
                     bitmap = Resize(bitmap, resizedWidth, resizedHeight);
@@ -325,11 +373,11 @@ namespace ComPDFKit.Controls.PDFControl
                     startPoint.X = (blankPageBitmap.Width - bitmap.Width) / 2;
                     startPoint.Y = (blankPageBitmap.Height - bitmap.Height) / 2;
                     printBitmap = PrintHelper.CombineBitmap(blankPageBitmap, bitmap, startPoint);
+
                 }
 
                 else
                 {
-                    // 按比例缩小bitmap
                     float scale = sizeModeInfo.SizeType == SizeType.Customized ? sizeModeInfo.Scale : 1;
                     bitmap = PrintHelper.ResizeBitmap(bitmap, scale);
                     startPoint.X = (blankPageBitmap.Width - bitmap.Width) / 2;
@@ -354,7 +402,7 @@ namespace ComPDFKit.Controls.PDFControl
         {
             if (object.Equals(properValue, newValue))
                 return false;
-             
+
             properValue = newValue;
             OnPropertyChanged(properName);
             return true;
@@ -382,7 +430,7 @@ namespace ComPDFKit.Controls.PDFControl
 
         private void txbPageIndex_LostFocus(object sender, RoutedEventArgs e)
         {
-            if(PaperIndex == string.Empty)
+            if (PaperIndex == string.Empty)
             {
                 PaperIndex = (originalPaperIndex).ToString();
             }
@@ -390,8 +438,8 @@ namespace ComPDFKit.Controls.PDFControl
 
         private void txbPageIndex_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
         {
-            if (e.NewFocus is Button button && (button == btnNextButton||button == btnPreButton))
-            { 
+            if (e.NewFocus is Button button && (button == btnNextButton || button == btnPreButton))
+            {
                 e.Handled = true;
             }
         }

+ 18 - 11
Demo/Examples/Compdfkit.Controls/Printer/PrinterDialog.xaml

@@ -55,7 +55,7 @@
                         </ComboBox>
                     </StackPanel>
 
-                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
+                    <StackPanel Margin="0,5,0,0">
                         <CheckBox      
                           x:Name="chkGrayScale"
                         VerticalAlignment="Center" 
@@ -86,21 +86,18 @@
                             FontFamily="Segoe UI"
                             FontSize="14" Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Oritation}"></TextBlock>
                         <ComboBox       
-                            x:Name="cmbOritation"
+                            x:Name="cmbOrientation"
                             Style="{StaticResource ComboBoxStyle1}" 
-                            SelectionChanged="cmbOritation_SelectionChanged"
+                            SelectionChanged="cmbOrientation_SelectionChanged"
                             Width="155"
                             Height="24" 
-                            Loaded="cmbOritation_Loaded" >
+                            Loaded="cmbOrientation_Loaded" >
                             <ComboBoxItem Tag="Portrait">
                                 <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Portrait}"></TextBlock>
                             </ComboBoxItem>
                             <ComboBoxItem Tag="Landscape">
                                 <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Landscape}"></TextBlock>
                             </ComboBoxItem>
-                            <ComboBoxItem Tag="Auto">
-                                <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Auto}"></TextBlock>
-                            </ComboBoxItem>
                         </ComboBox>
                     </StackPanel>
                 </StackPanel>
@@ -115,7 +112,7 @@
                 <RadioButton  Margin="-8,0,0,8"  GroupName="Page Range" x:Name="rdoOddPages" Tag="Odd"  Click="rdoPageRange_Click">
                     <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_OnlyOdd}"></TextBlock>
                 </RadioButton>
-                <RadioButton  Margin="-8,0,0,8" GroupName="Page Range" x:Name="rdoEvenPages" Tag="Even"  Click="rdoPageRange_Click">
+                <RadioButton  Margin="-8,0,0,8" GroupName="Page Range" x:Name="rdoEvenPages" Tag="Even"  Click="rdoPageRange_Click" IsEnabled="{Binding IsEvenEnabled}">
                     <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_OnlyEven}"></TextBlock>
                 </RadioButton>
                 <StackPanel Orientation="Horizontal">
@@ -191,17 +188,27 @@
                     </Grid>
                 </Grid>
             </StackPanel>
+            <StackPanel Orientation="Vertical" Margin="0,0,0,8">
+                <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Border}"  Style="{StaticResource TitleTextBlockStyle}"></TextBlock>
+                <RadioButton x:Name="rdoFitPrintable" GroupName="Bordless"  Margin="0,0,0,8"  IsChecked="True" Checked="rdoFitPrintable_Checked">
+                    <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_FitPrintable}"></TextBlock>
+                </RadioButton>
+                <RadioButton x:Name="rdoFitPage" GroupName="Bordless" Checked="rdoFitPage_Checked">
+                    <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_FitPage}"></TextBlock>
+                </RadioButton>
+            </StackPanel>
             <StackPanel Grid.Row="3" VerticalAlignment="Top" >
                 <CheckBox Name="chkDuplex" Margin="0,8,0,8" Tag="" Click="chkDuplex_Click">
-                    <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Duplex}"></TextBlock>
+                    <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_Duplex}"  Style="{StaticResource TitleTextBlockStyle}" Margin="0"></TextBlock>
                 </CheckBox>
-                <RadioButton GroupName="Flip" x:Name="rdoLongEdge" Tag="LongEdge" IsChecked="True" IsEnabled="{Binding IsChecked, ElementName=chkDuplex, Converter={StaticResource BoolToVisibleConverter}}" Margin="0,0,0,8" Click="rdoDuplex_Click" >
+                <RadioButton GroupName="Flip" x:Name="rdoLongEdge" Tag="LongEdge" IsChecked="True" Visibility="{Binding IsChecked, ElementName=chkDuplex, Converter={StaticResource BoolToVisibleConverter}}" Margin="0,0,0,8" Click="rdoDuplex_Click" >
                     <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_LongEdge}"></TextBlock>
                 </RadioButton>
-                <RadioButton GroupName="Flip" x:Name="rdoShortEdge" Tag="ShortEdge" Click="rdoDuplex_Click" IsEnabled="{Binding IsChecked, ElementName=chkDuplex, Converter={StaticResource BoolToVisibleConverter}}">
+                <RadioButton GroupName="Flip" x:Name="rdoShortEdge" Tag="ShortEdge" Click="rdoDuplex_Click" Visibility="{Binding IsChecked, ElementName=chkDuplex, Converter={StaticResource BoolToVisibleConverter}}">
                     <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Printer_ShortEdge}"></TextBlock>
                 </RadioButton>
             </StackPanel>
+
         </StackPanel>
 
         <StackPanel Grid.Column="2" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">

+ 109 - 23
Demo/Examples/Compdfkit.Controls/Printer/PrinterDialog.xaml.cs

@@ -6,6 +6,7 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Drawing.Printing;
 using System.Linq;
+using System.Printing;
 using System.Runtime.CompilerServices;
 using System.Windows;
 using System.Windows.Controls;
@@ -17,6 +18,10 @@ namespace ComPDFKit.Controls.PDFControl
     /// </summary>
     public partial class PrinterDialog : Window, INotifyPropertyChanged
     {
+        private bool isInited = false;
+
+        private PrintServer PrintServer = new PrintServer();
+        private PrintQueue printQueue;
         private PrinterSettings printerSettings;
 
         private PrintSettingsInfo printSettingsInfo = new PrintSettingsInfo();
@@ -61,10 +66,14 @@ namespace ComPDFKit.Controls.PDFControl
         public bool IsSheetEnabled
         {
             get => _isSheetEnabled;
-            set
-            {
-                UpdateProper(ref _isSheetEnabled, value);
-            }
+            set => UpdateProper(ref _isSheetEnabled, value);
+        }
+
+        private bool _isEvenEnabled = false;
+        public bool IsEvenEnabled
+        {
+            get => _isEvenEnabled;
+            set => UpdateProper(ref _isEvenEnabled, value);
         }
 
         private string _sheetColumn = 2.ToString();
@@ -101,7 +110,11 @@ namespace ComPDFKit.Controls.PDFControl
 
         public CPDFDocument Document
         {
-            set => printSettingsInfo.Document = value;
+            set
+            {
+                printSettingsInfo.Document = value;
+                IsEvenEnabled = value.PageCount > 1;
+            }
             private get => printSettingsInfo.Document;
         }
 
@@ -120,11 +133,11 @@ namespace ComPDFKit.Controls.PDFControl
             cmbPrinterName.ItemsSource = printerList;
             cmbPrinterName.SelectedIndex = printerList.Contains("Microsoft Print to PDF") ? printerList.IndexOf("Microsoft Print to PDF") : 0;
         }
-
         #endregion 
 
         private void PrinterDialog_Loaded(object sender, RoutedEventArgs e)
         {
+
             InitPrinterNameList();
             InitPrinterSettingsMode();
             ctlPreview.Init(printSettingsInfo);
@@ -135,14 +148,13 @@ namespace ComPDFKit.Controls.PDFControl
             printSettingsInfo.Copies = 1;
             printSettingsInfo.PrinterName = cmbPrinterName.SelectedItem.ToString();
             printSettingsInfo.PrintMode = sizeModeInfo;
-            printSettingsInfo.PrintOrientation = PrintOrientation.Portrait;
+            printSettingsInfo.PrintOrientation = PageOrientation.Portrait;
             printSettingsInfo.PaperSize = printerSettings.PaperSizes[cmbPaper.SelectedIndex];
 
             printSettingsInfo.IsPrintAnnot = true;
             printSettingsInfo.IsPrintForm = true;
             printSettingsInfo.IsReverseOrder = false;
-            printSettingsInfo.IsGrayscale = false;
-            printSettingsInfo.IsDuplex = false;
+            printSettingsInfo.IsGrayscale = false; 
 
             printSettingsInfo.DuplexPrintMod = DuplexPrintMod.None;
             printSettingsInfo.PageRangeList = Enumerable.Range(0, Document.PageCount).ToList();
@@ -153,6 +165,7 @@ namespace ComPDFKit.Controls.PDFControl
             printSettingsInfo.NeedReversePage = false;
 
             printSettingsInfo.PrintMode = sizeModeInfo;
+            isInited = true;
         }
 
         private void InitPaperList()
@@ -167,14 +180,42 @@ namespace ComPDFKit.Controls.PDFControl
             }
             int IndexOfA4 = printerSettings.PaperSizes.Cast<PaperSize>().ToList().FindIndex(x => x.PaperName == "A4");
             cmbPaper.SelectedIndex = IndexOfA4 != -1 ? IndexOfA4 : 0;
+            printSettingsInfo.PaperSize = printerSettings.PaperSizes[cmbPaper.SelectedIndex];
         }
 
         private void cmbPrinterName_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             printSettingsInfo.PrinterName = e.AddedItems[0].ToString();
+            if (printSettingsInfo.PrinterName != string.Empty)
+            {
+                try
+                {
+                    printQueue = PrintHelper.GetPrintQueue(PrintServer, printSettingsInfo.PrinterName);
+                    PrintHelper.printQueue = printQueue;
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine(ex.Message);
+                    return;
+                }
+
+
+                PrintTicket printTicket = printQueue.DefaultPrintTicket;
+                PrintCapabilities printCapabilities = printQueue.GetPrintCapabilities();
+                double printableWidth = printCapabilities.PageImageableArea.ExtentWidth / 0.96;
+                double printableHeight = printCapabilities.PageImageableArea.ExtentHeight / 0.96;
+                double originWidth = printCapabilities.PageImageableArea.OriginWidth / 0.96;
+                double originHeight = printCapabilities.PageImageableArea.OriginHeight / 0.96;
+                printSettingsInfo.Margins = new Thickness() { Left = originWidth, Top = originHeight, Right = printSettingsInfo.PaperSize.Width - originHeight - printableWidth, Bottom = printSettingsInfo.PaperSize.Height - originWidth - printableHeight };
+
+                if (isInited)
+                {
+                    ctlPreview.Init(printSettingsInfo);
+                }
+            }
         }
 
-        private void cmbOritation_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void cmbOrientation_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             if (!IsLoaded)
             {
@@ -184,13 +225,10 @@ namespace ComPDFKit.Controls.PDFControl
             switch (tag)
             {
                 case "Portrait":
-                    printSettingsInfo.PrintOrientation = PrintOrientation.Portrait;
+                    printSettingsInfo.PrintOrientation = PageOrientation.Portrait;
                     break;
                 case "Landscape":
-                    printSettingsInfo.PrintOrientation = PrintOrientation.Landscape;
-                    break;
-                case "Auto":
-                    printSettingsInfo.PrintOrientation = PrintOrientation.Auto;
+                    printSettingsInfo.PrintOrientation = PageOrientation.Landscape;
                     break;
             }
             ctlPreview.Init(printSettingsInfo);
@@ -243,24 +281,39 @@ namespace ComPDFKit.Controls.PDFControl
         private void chkDuplex_Click(object sender, RoutedEventArgs e)
         {
             var chk = sender as CheckBox;
-            printSettingsInfo.IsDuplex = chk.IsChecked.Value;
-            if (rdoLongEdge.IsChecked.GetValueOrDefault())
+            if (chk.IsChecked.GetValueOrDefault())
             {
-                printSettingsInfo.DuplexPrintMod = DuplexPrintMod.FlipLongEdge;
+                if (rdoLongEdge.IsChecked.GetValueOrDefault())
+                {
+                    printSettingsInfo.DuplexPrintMod = DuplexPrintMod.FlipLongEdge;
+                }
+                else
+                {
+                    printSettingsInfo.DuplexPrintMod = DuplexPrintMod.FlipShortEdge;
+                }
             }
             else
             {
-                printSettingsInfo.DuplexPrintMod = DuplexPrintMod.FlipShortEdge;
+                printSettingsInfo.DuplexPrintMod = DuplexPrintMod.None;
             }
         }
 
+
         private void rdoDuplex_Click(object sender, RoutedEventArgs e)
         {
             var chk = sender as RadioButton;
-            if (chk.IsChecked.GetValueOrDefault())
+            if (chkDuplex.IsChecked.GetValueOrDefault())
+            {
+                if (chk.IsChecked.GetValueOrDefault())
+                {
+                    printSettingsInfo.DuplexPrintMod = chk.Tag.ToString() == "LongEdge" ? DuplexPrintMod.FlipLongEdge : DuplexPrintMod.FlipShortEdge;
+                }
+            }
+            else
             {
-                printSettingsInfo.DuplexPrintMod = chk.Tag.ToString() == "LongEdge" ? DuplexPrintMod.FlipLongEdge : DuplexPrintMod.FlipShortEdge;
+                printSettingsInfo.DuplexPrintMod = DuplexPrintMod.None;
             }
+
         }
 
         private void cmbPaper_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -355,11 +408,13 @@ namespace ComPDFKit.Controls.PDFControl
             OnPropertyChanged(properName);
             return true;
         }
+
         protected void OnPropertyChanged([CallerMemberName] string propertyName = "") =>
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 
         private void btnConfirm_Click(object sender, RoutedEventArgs e)
         {
+            PrintHelper.InitPrint();
             PrintHelper.PrintDocument(printSettingsInfo);
             Close();
         }
@@ -369,14 +424,45 @@ namespace ComPDFKit.Controls.PDFControl
             Close();
         }
 
-        private void cmbOritation_Loaded(object sender, RoutedEventArgs e)
+        private void cmbOrientation_Loaded(object sender, RoutedEventArgs e)
         {
-            cmbOritation.SelectedIndex = 0;
+            bool isHeightWidthRatioGreaterThanOne = (printSettingsInfo.ActualHeight / printSettingsInfo.ActualWidth > 1) &&
+                                                    (Document.GetPageSize(0).height / Document.GetPageSize(0).width > 1);
+
+            bool isHeightWidthRatioLessThanOne = (printSettingsInfo.ActualHeight / printSettingsInfo.ActualWidth < 1) &&
+                                                 (Document.GetPageSize(0).height / Document.GetPageSize(0).width < 1);
+
+            cmbOrientation.SelectedIndex = (isHeightWidthRatioGreaterThanOne || isHeightWidthRatioLessThanOne) ? 0 : 1;
         }
 
         private void cmbContent_Loaded(object sender, RoutedEventArgs e)
         {
             cmbContent.SelectedIndex = 1;
         }
+
+        private void chkBorderless_Click(object sender, RoutedEventArgs e)
+        {
+            var chk = sender as CheckBox;
+            printSettingsInfo.IsBorderless = chk.IsChecked.Value;
+            ctlPreview.Init(printSettingsInfo);
+        }
+
+        private void rdoFitPrintable_Checked(object sender, RoutedEventArgs e)
+        {
+            printSettingsInfo.IsBorderless = false;
+            if (isInited)
+            {
+                ctlPreview.Init(printSettingsInfo);
+            }
+        }
+
+        private void rdoFitPage_Checked(object sender, RoutedEventArgs e)
+        {
+            printSettingsInfo.IsBorderless = true;
+            if (isInited)
+            {
+                ctlPreview.Init(printSettingsInfo);
+            }
+        }
     }
 }

+ 18 - 12
Demo/Examples/Compdfkit.Controls/Printer/PrinterModel.cs

@@ -9,14 +9,7 @@ using System.Windows;
 using ComPDFKit.PDFDocument;
 
 namespace ComPDFKit.Controls
-{
-    public enum PrintOrientation
-    {
-        Portrait,
-        Landscape,
-        Auto
-    }
-
+{ 
     public enum DuplexStage
     {
         None,
@@ -88,24 +81,30 @@ namespace ComPDFKit.Controls
         public CPDFDocument Document;
         public bool IsGrayscale { get; set; } = false;
         public bool IsReverseOrder { get; set; } = false;
-        public bool IsDuplex { get; set; } = false;
         public bool NeedRerendering { get; set; } = true;
         public bool IsPaperSizeChanged { get; set; } = false;
         public bool NeedReversePage { get; set; } = false;
         public bool IsPrintAnnot { get; set; } = true;
         public bool IsPrintForm { get; set; } = true;
+        public bool IsBorderless { get; set; } = false;
+
+        public List<int> TargetPaperList = new List<int>();
+
+        public PageMargins PageMargins { get; set; } = new PageMargins() { Top = 0, Bottom = 0, Left = 0, Right = 0 };
 
         public int Copies { get; set; } = 1;
 
         public string PrinterName { get; set; } = string.Empty;
 
         public DuplexPrintMod DuplexPrintMod { get; set; } = DuplexPrintMod.None;
-        public PrintOrientation PrintOrientation { get; set; } = PrintOrientation.Portrait; 
-        public Rect PageBound { get; set; } = new Rect(); 
+        public PageOrientation PrintOrientation { get; set; } = PageOrientation.Portrait;
+        public Rect PageBound { get; set; } = new Rect();
         public List<int> PageRangeList = new List<int>();
         public PrintDocument PrintDocument { get; set; } = new PrintDocument();
-        public Margins Margins { get; set; } = new Margins() { Bottom = 0, Left = 0, Right = 0, Top = 0 };
+        public Thickness Margins { get; set; } = new Thickness() { Bottom = 0, Left = 0, Right = 0, Top = 0 };
         public PaperSize PaperSize { get; set; } = null;
+        public double ActualHeight { get => PaperSize.Height - Margins.Bottom - Margins.Top; }
+        public double ActualWidth { get => PaperSize.Width - Margins.Left - Margins.Right; }
         public PrintMode PrintMode { get; set; } = null;
     }
 
@@ -162,4 +161,11 @@ namespace ComPDFKit.Controls
         public int EndPageIndex { get; set; }
         public bool IsAutoRotate { get; set; } = false;
     }
+    public struct PageMargins
+    {
+        public double Top { get; set; }
+        public double Bottom { get; set; }
+        public double Left { get; set; }
+        public double Right { get; set; }
+    }
 }

+ 13 - 1
Demo/Examples/Compdfkit.Controls/Strings/Common.resx

@@ -520,7 +520,7 @@
     <value>All Pages</value>
   </data>
   <data name="Printer_Auto" xml:space="preserve">
-    <value />
+    <value>Auto</value>
   </data>
   <data name="Printer_AutoAdapt" xml:space="preserve">
     <value>Auto Adapt</value>
@@ -591,4 +591,16 @@
   <data name="Printer_Print" xml:space="preserve">
     <value>Print</value>
   </data>
+  <data name="Printer_Borderless" xml:space="preserve">
+    <value>Borderless Printing</value>
+  </data>
+  <data name="Printer_Border" xml:space="preserve">
+    <value>Border</value>
+  </data>
+  <data name="Printer_FitPage" xml:space="preserve">
+    <value>Fit to Page</value>
+  </data>
+  <data name="Printer_FitPrintable" xml:space="preserve">
+    <value>Fit to Printable Area</value>
+  </data>
 </root>

+ 12 - 0
Demo/Examples/Compdfkit.Controls/Strings/Common.zh.resx

@@ -591,4 +591,16 @@
   <data name="Printer_Print" xml:space="preserve">
     <value>打印</value>
   </data>
+  <data name="Printer_Borderless" xml:space="preserve">
+    <value>无边距打印</value>
+  </data>
+  <data name="Printer_Border" xml:space="preserve">
+    <value>边距</value>
+  </data>
+  <data name="Printer_FitPage" xml:space="preserve">
+    <value>适合纸张</value>
+  </data>
+  <data name="Printer_FitPrintable" xml:space="preserve">
+    <value>适合可打印区域</value>
+  </data>
 </root>