Browse Source

compdfkit(win) - 修复 demo 崩溃问题:图片参数为空,新建文件无默认路径,搜索时保存崩溃,新增点击创建超链接注释后,超链接高亮

liuaoran 11 months ago
parent
commit
4fe7eaa9d6

+ 5 - 35
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -501,42 +501,12 @@ namespace Compdfkit_Tools.PDFControl
             {
                 panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
             }
-        }
 
-        //private void PDFView_AnnotActiveHandler(object sender, AnnotAttribEvent e)
-        //{
-        //    PropertyContainer.Child = PDFAnnotationControl;
-        //    PDFAnnotationControl.SetAnnotEventData(e);
-        //}
-
-        //private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
-        //{
-        //    if ((e is WidgetSignArgs args))
-        //    {
-        //        var signatureWidget = args.Sign;
-        //        if(signatureWidget != null)
-        //        {
-        //            CPDFSignature sig = signatureWidget.GetSignature(PDFViewControl.PDFView.Document);
-        //            if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
-        //            {
-        //                return;
-        //            }
-        //        }
-
-        //        if (args.WidgetType == C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS)
-        //        {
-        //            panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
-        //            CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
-        //            signatureProperty.SetFormProperty(args, PDFViewControl.PDFView);
-        //            PropertyContainer.Child = signatureProperty;
-        //        }
-        //    }
-        //}
-
-        //private void PDFView_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
-        //{
-        //    OnAnnotEditHandler.Invoke(this, null);
-        //}
+            if(e == CPDFAnnotationType.Link)
+            {
+                PDFViewControl.PDFViewTool.GetCPDFViewer().SetLinkHighlight(true);
+            }
+        }
 
         private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
         {

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

@@ -162,7 +162,7 @@ namespace Compdfkit_Tools.Edit
             if (RotationTxb != null && newEvent != null && newEvent.EditType == CPDFEditType.EditImage)
             {
                 GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
-                RotationTxb.Text = imageArea.GetRotation().ToString();
+                RotationTxb.Text = imageArea?.GetRotation().ToString();
                 //RotationTxb.Text = newEvent.Rotate.ToString(CultureInfo.CurrentCulture);
             }
 

+ 9 - 3
Demo/Examples/Compdfkit_Tools/PDFView/PDFSearch/PDFSearchControl/CPDFSearchControl.xaml.cs

@@ -293,7 +293,10 @@ namespace Compdfkit_Tools.PDFControl
             {
                 if (ViewControl.PDFViewTool.IsDocumentModified)
                 {
-                    pdfView.GetDocument().WriteToLoadedPath();
+                    if (pdfView.GetDocument().FilePath != string.Empty)
+                    {
+                        pdfView.GetDocument().WriteToLoadedPath();
+                    }
                 }
                 keyWord = e;
                 textSearch.TextSearchDocument = pdfView.GetDocument();
@@ -348,8 +351,11 @@ namespace Compdfkit_Tools.PDFControl
         {
             if (ViewControl.PDFViewTool.IsDocumentModified)
             {
-                pdfView.GetDocument().WriteToLoadedPath();
-               ViewControl.PDFViewTool.IsDocumentModified = false;
+                if (pdfView.GetDocument().FilePath != string.Empty)
+                {
+                    pdfView.GetDocument().WriteToLoadedPath();
+                    ViewControl.PDFViewTool.IsDocumentModified = false;
+                } 
             } 
             ReplaceTog.IsChecked = false;
             SearchInput.InputGrid.RowDefinitions[1].Height = new GridLength(0);