Browse Source

Core-替换.net Core代码

zhuyi 1 year ago
parent
commit
c3f6e7d27d

+ 2 - 1
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateStampDialog.xaml.cs

@@ -1,4 +1,5 @@
 using ComPDFKit.PDFAnnotation;
+using ComPDFKit.Tool.Help;
 using Compdfkit_Tools.Data;
 using Microsoft.Win32;
 using System;
@@ -177,7 +178,7 @@ namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
                 date = DateTime.Now.ToString(dateType);
             }
 
-            var bytes = CPDFStampAnnotation.GetTempTextStampImage(StampText.Text, date,
+            byte[] bytes = PDFDateHelp.GetTempTextStampImage(StampText.Text, date,
             Shape, Color, out int stampWidth, out int stampHeight, out int width, out int height);
             if (bytes.Length > 0)
             {

+ 6 - 6
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml.cs

@@ -117,7 +117,7 @@ namespace Compdfkit_Tools.PDFControl
             tempSignatureConfig.IsDrawLogo = (bool)LogoChk.IsChecked;
             if (tempSignatureConfig.IsDrawLogo)
             {
-                tempSignatureConfig.LogoBitmap = new Bitmap(logoPath);
+                //tempSignatureConfig.LogoBitmap = new Bitmap(logoPath);
             }
             tempSignatureConfig.Content = Text;
             tempSignatureConfig.TextColor = textColor;
@@ -198,7 +198,7 @@ namespace Compdfkit_Tools.PDFControl
                 if (clickBorder == KeyboardBorder)
                 {
                     tempSignatureConfig.Text = signatureName;
-                    tempSignatureConfig.ImageBitmap = null;
+                    //tempSignatureConfig.ImageBitmap = null;
                     KeyboardPopup.Visibility = Visibility.Visible;
                 }
                 else
@@ -213,7 +213,7 @@ namespace Compdfkit_Tools.PDFControl
                         ImagePickPanel.Visibility = Visibility.Visible;
                         if (!string.IsNullOrEmpty(imagePath))
                         {
-                            tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                            //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
                         }
                     }
                 }
@@ -256,7 +256,7 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CanvasPopupConfirm_Click(object sender, RoutedEventArgs e)
         {
-            tempSignatureConfig.ImageBitmap = GetDrawInk();
+            //tempSignatureConfig.ImageBitmap = GetDrawInk();
             CanvaDrawPopup.Visibility = Visibility.Collapsed;
             SetProperty();
             CreateTempSignature();
@@ -440,7 +440,7 @@ namespace Compdfkit_Tools.PDFControl
                 imagePath = pngPath;
                 try
                 {
-                    tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                    //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
                 }
                 catch (Exception exception)
                 {
@@ -455,7 +455,7 @@ namespace Compdfkit_Tools.PDFControl
         private void ClearTxt_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
             imagePath = string.Empty;
-            tempSignatureConfig.ImageBitmap = null;
+            //tempSignatureConfig.ImageBitmap = null;
             SetProperty();
             CreateTempSignature();
         }

+ 3 - 2
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs

@@ -1,4 +1,5 @@
-using ComPDFKit.PDFDocument;
+using ComPDFKit.Import;
+using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
 using ComPDFKit.PDFPage.Edit;
 using ComPDFKit.Tool;
@@ -182,7 +183,7 @@ namespace Compdfkit_Tools.Edit
                     GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
                     if (imageArea != null)
                     {
-                        Rect imageRect= imageArea.GetClipRect();
+                        CRect imageRect= imageArea.GetClipRect();
                         if (imageArea.ReplaceImageArea(imageRect,openFileDialog.FileName,string.Empty))
                         {
                             PDFEditHistory editHistory = new PDFEditHistory();

+ 11 - 10
Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml.cs

@@ -3,6 +3,7 @@ using ComPDFKit.PDFPage;
 using ComPDFKit.PDFPage.Edit;
 using ComPDFKit.Tool;
 using ComPDFKit.Tool.UndoManger;
+using ComPDFKit.Viewer.Helper;
 using ComPDFKitViewer;
 using System;
 using System.Collections.Generic;
@@ -78,7 +79,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect=textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontSize((float)slider.Value,false))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -104,7 +105,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect=textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if(textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255)))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -134,7 +135,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect=textArea.GetFrame();
+                Rect oldRect=DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontTransparency((byte)(FontOpacitySlider.Value * 255)))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -169,7 +170,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect=textArea.GetFrame();
+                Rect oldRect=DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontSize((float)slider.Value,false))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -207,7 +208,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect=textArea.GetFrame();
+                Rect oldRect=DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontSize((float)e, false))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -228,7 +229,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null && newBrush!=null)
             {
-                Rect oldRect= textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontColor(newBrush.Color.R, newBrush.Color.G, newBrush.Color.B))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -249,7 +250,7 @@ namespace Compdfkit_Tools.Edit
             if (textArea != null)
             {
                 bool result = false;
-                Rect oldRect= textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if(textArea.SelectLineRects!=null && textArea.SelectLineRects.Count>0)
                 {
                     result = textArea.SetTextRangeAlign(e);
@@ -277,7 +278,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect= textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if(textArea.SetCharsFontItalic(e))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -297,7 +298,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect= textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontBold(e))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();
@@ -317,7 +318,7 @@ namespace Compdfkit_Tools.Edit
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
             if (textArea != null)
             {
-                Rect oldRect= textArea.GetFrame();
+                Rect oldRect= DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
                 if (textArea.SetCharsFontName(e))
                 {
                     PDFEditHistory editHistory = new PDFEditHistory();

+ 2 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFThumbnail/PDFThumbnailControl/CPdfThumbnailControl.xaml.cs

@@ -1,5 +1,6 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
+using ComPDFKit.Viewer.Helper;
 using Compdfkit_Tools.PDFControlUI;
 using ComPDFKitViewer;
 using System;
@@ -156,7 +157,7 @@ namespace Compdfkit_Tools.PDFControl
             }
             for (int i = 0; i < pdfdoc.PageCount; i++)
             {
-                Size pageSize = pdfdoc.GetPageSize(i);
+                Size pageSize = DataConversionForWPF.CSizeConversionForSize(pdfdoc.GetPageSize(i));
 
                 int imageWidth = 0; 
                 int imageHeight = 0; 

+ 5 - 4
Demo/Examples/Compdfkit_Tools/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs

@@ -1,5 +1,6 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
+using ComPDFKit.Viewer.Helper;
 using Compdfkit_Tools.PDFControlUI;
 using ComPDFKitViewer;
 using Microsoft.Win32;
@@ -1146,7 +1147,7 @@ namespace Compdfkit_Tools.PDFControl
             int thumbnailWidth = thumbnailSize[zoomLevel];
             for (int i = 0; i < pdfDoc.PageCount; i++)
             {
-                Size pageSize = pdfDoc.GetPageSize(i);
+                Size pageSize = DataConversionForWPF.CSizeConversionForSize(pdfDoc.GetPageSize(i));
                 if (pageSize.Height == 0 || pageSize.Width == 0)
                     continue;
 
@@ -1227,7 +1228,7 @@ namespace Compdfkit_Tools.PDFControl
             {
                 return new ListBoxItem();
             }
-            Size pageSize = pdfDoc.GetPageSize(ItemIndex);
+            Size pageSize = DataConversionForWPF.CSizeConversionForSize(pdfDoc.GetPageSize(ItemIndex));
             if (pageSize.Width == 0 || pageSize.Height == 0) 
             {
                 pageSize = new Size(228, 300);
@@ -1548,11 +1549,11 @@ namespace Compdfkit_Tools.PDFControl
                 if(pdfDoc!=null)
                 {
                     var size = pdfDoc.GetPageSize(data.InsertIndex - 1);
-                    if (size.Width == 0 || size.Height == 0)
+                    if (size.width == 0 || size.height == 0)
                     {
                         size = pdfDoc.GetPageSize(data.InsertIndex);
                     }
-                    pdfDoc.InsertPage(data.InsertIndex, size.Width, size.Height, "");
+                    pdfDoc.InsertPage(data.InsertIndex, size.width, size.height, "");
                 }
                 
                 RefreshThumbnail();

+ 36 - 0
Demo/Examples/Examlpes.sln

@@ -665,6 +665,42 @@ Global
 		{783263CF-0DA3-4095-9DF8-2C4A6B3FF908}.Release|x64.Build.0 = Release|Any CPU
 		{783263CF-0DA3-4095-9DF8-2C4A6B3FF908}.Release|x86.ActiveCfg = Release|Any CPU
 		{783263CF-0DA3-4095-9DF8-2C4A6B3FF908}.Release|x86.Build.0 = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|x64.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Debug|x86.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|Any CPU.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|Any CPU.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|x64.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|x64.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|x86.ActiveCfg = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.DemoTest|x86.Build.0 = Debug|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|x64.ActiveCfg = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|x64.Build.0 = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|x86.ActiveCfg = Release|Any CPU
+		{A8AF1E5F-E8A0-43E7-91CE-615580B29325}.Release|x86.Build.0 = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|x64.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Debug|x86.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|Any CPU.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|Any CPU.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|x64.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|x64.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|x86.ActiveCfg = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.DemoTest|x86.Build.0 = Debug|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|x64.ActiveCfg = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|x64.Build.0 = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|x86.ActiveCfg = Release|Any CPU
+		{5498DB67-4E92-4C6C-A8B9-4729165DEDB2}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE