|
@@ -4,6 +4,7 @@ using ComPDFKit.PDFPage;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using ComPDFKitViewer.PdfViewer;
|
|
using ComPDFKitViewer.PdfViewer;
|
|
using Microsoft.Win32;
|
|
using Microsoft.Win32;
|
|
|
|
+using PDF_Office.Helper;
|
|
using PDF_Office.Model;
|
|
using PDF_Office.Model;
|
|
using PDF_Office.Model.AnnotPanel;
|
|
using PDF_Office.Model.AnnotPanel;
|
|
using PDF_Office.Properties;
|
|
using PDF_Office.Properties;
|
|
@@ -16,6 +17,7 @@ using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.ObjectModel;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
+using System.Reflection;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
@@ -233,6 +235,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
Args.MaxHeight = stamp.MaxHeight;
|
|
Args.MaxHeight = stamp.MaxHeight;
|
|
Args.StampTextDate = stamp.StampTextDate;
|
|
Args.StampTextDate = stamp.StampTextDate;
|
|
Args.TextColor = stamp.TextColor;
|
|
Args.TextColor = stamp.TextColor;
|
|
|
|
+ Args.TextSharp = stamp.TextSharp;
|
|
if (!string.IsNullOrEmpty(stamp.SourcePath))
|
|
if (!string.IsNullOrEmpty(stamp.SourcePath))
|
|
{
|
|
{
|
|
BitmapImage image = new BitmapImage(new Uri(stamp.SourcePath));
|
|
BitmapImage image = new BitmapImage(new Uri(stamp.SourcePath));
|
|
@@ -298,13 +301,15 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
PixelFormat fmt = PixelFormats.Bgra32;
|
|
PixelFormat fmt = PixelFormats.Bgra32;
|
|
BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, bytes, (width * fmt.BitsPerPixel + 7) / 8);
|
|
BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, bytes, (width * fmt.BitsPerPixel + 7) / 8);
|
|
|
|
|
|
-
|
|
|
|
|
|
+ var flags = BindingFlags.NonPublic | BindingFlags.Static;
|
|
|
|
+ var dpiProperty = typeof(SystemParameters).GetProperty("Dpi", flags);
|
|
|
|
+ int Dpi = (int)dpiProperty.GetValue(null, null);
|
|
|
|
|
|
standardStamp.Opacity = 1;
|
|
standardStamp.Opacity = 1;
|
|
standardStamp.SourcePath = "";
|
|
standardStamp.SourcePath = "";
|
|
standardStamp.StampText = DynamicStampText[i];
|
|
standardStamp.StampText = DynamicStampText[i];
|
|
- standardStamp.MaxWidth = stampWidth;
|
|
|
|
- standardStamp.MaxHeight = stampHeight;
|
|
|
|
|
|
+ standardStamp.MaxWidth = (int)DpiHelpers.GetDpiUnrelatedNum(stampWidth / 72D * DpiHelpers.Dpi);
|
|
|
|
+ standardStamp.MaxHeight = (int)DpiHelpers.GetDpiUnrelatedNum(stampHeight / 72D * DpiHelpers.Dpi);
|
|
standardStamp.Type = StampType.TEXT_STAMP;
|
|
standardStamp.Type = StampType.TEXT_STAMP;
|
|
standardStamp.ImageSource = bps;
|
|
standardStamp.ImageSource = bps;
|
|
switch (DynamicColor[i])
|
|
switch (DynamicColor[i])
|
|
@@ -436,10 +441,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
stamp.Opacity = 1;
|
|
stamp.Opacity = 1;
|
|
stamp.SourcePath = viewModel.SaveToPath;
|
|
stamp.SourcePath = viewModel.SaveToPath;
|
|
stamp.StampText = viewModel.StampText;
|
|
stamp.StampText = viewModel.StampText;
|
|
- stamp.MaxWidth = viewModel.ImageSource.PixelWidth;
|
|
|
|
- stamp.MaxHeight = viewModel.ImageSource.PixelHeight;
|
|
|
|
|
|
+ stamp.MaxWidth = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampWidth/ 72D * DpiHelpers.Dpi);
|
|
|
|
+ stamp.MaxHeight = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampHeight / 72D * DpiHelpers.Dpi);
|
|
stamp.StampTextDate = viewModel.StampTextDate;
|
|
stamp.StampTextDate = viewModel.StampTextDate;
|
|
stamp.Type = viewModel.Type;
|
|
stamp.Type = viewModel.Type;
|
|
|
|
+ stamp.TextColor = (TextStampColor)(int)viewModel.Color;
|
|
|
|
+ stamp.TextSharp = (TextStampSharp)(int)viewModel.Shape;
|
|
CustomStampList.Add(stamp);
|
|
CustomStampList.Add(stamp);
|
|
}
|
|
}
|
|
}
|
|
}
|