Browse Source

ComPDFKit.Tool(win) - 支持Path对象编辑

TangJinZhou 2 months ago
parent
commit
8f7f410a33

+ 1 - 1
Demo/Examples/ComPDFKit.Tool/CPDFToolManager.cs

@@ -2327,7 +2327,7 @@ namespace ComPDFKit.Tool
 
                             EditAreaObject editAreaObject = viewerTool.GetEditAreaObjectForRect(viewerTool.GetLastSelectedRect());
                             if (pointControlType != PointControlType.None &&
-                                (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage || pointControlType != PointControlType.Body))
+                                (editAreaObject.cPDFEditArea.Type != CPDFEditType.EditText || pointControlType != PointControlType.Body))
                             {
                                 switch (pointControlType)
                                 {

+ 74 - 2
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.Command.cs

@@ -276,6 +276,12 @@ namespace ComPDFKit.Tool
                             e.CanExecute = true;
                             break;
                         }
+
+                        if (checkItem.EditType == CPDFEditType.EditPath && checkItem.EditAreaCopied)
+                        {
+                            e.CanExecute = true;
+                            break;
+                        }
                     }
                     try
                     {
@@ -456,6 +462,7 @@ namespace ComPDFKit.Tool
                         commandData.PDFRect = DataConversionForWPF.CRectConversionForRect(currentEditAreaObject.cPDFEditArea.GetFrame());
                         lastPDFEditArgsList.Add(commandData);
                     }
+
                     if (currentEditAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage)
                     {
                         editType = CPDFEditType.EditImage;
@@ -471,6 +478,22 @@ namespace ComPDFKit.Tool
                             lastPDFEditArgsList.Add(commandData);
                         }
                     }
+
+                    if (currentEditAreaObject.cPDFEditArea.Type == CPDFEditType.EditPath)
+                    {
+                        editType = CPDFEditType.EditPath;
+                        CPDFEditPage editPage = currentEditAreaObject.cPDFEditPage;
+                        commandData.PDFRect = DataConversionForWPF.CRectConversionForRect(currentEditAreaObject.cPDFEditArea.GetFrame());
+                        commandData.EditAreaCopied = editPage.CopyEditArea(currentEditAreaObject.cPDFEditArea);
+                        commandData.EditType = CPDFEditType.EditPath;
+                        if (commandData.EditAreaCopied)
+                        {
+                            List<CPDFCopyEditArea> copyList = editPage.GetCopyEditAreaList();
+                            commandData.CopyArea = copyList[copyList.Count - 1];
+                            commandData.EditPage = editPage;
+                            lastPDFEditArgsList.Add(commandData);
+                        }
+                    }
                 }
                 else
                 {
@@ -517,6 +540,7 @@ namespace ComPDFKit.Tool
                                     commandData.PDFRect = DataConversionForWPF.CRectConversionForRect(editAreaObject.cPDFEditArea.GetFrame());
                                     lastPDFEditArgsList.Add(commandData);
                                 }
+
                                 if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage)
                                 {
                                     editType = CPDFEditType.EditImage;
@@ -532,6 +556,22 @@ namespace ComPDFKit.Tool
                                         lastPDFEditArgsList.Add(commandData);
                                     }
                                 }
+
+                                if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditPath)
+                                {
+                                    editType = CPDFEditType.EditPath;
+                                    CPDFEditPage editPage = editAreaObject.cPDFEditPage;
+                                    commandData.PDFRect = DataConversionForWPF.CRectConversionForRect(editAreaObject.cPDFEditArea.GetFrame());
+                                    commandData.EditAreaCopied = editPage.CopyEditArea(editAreaObject.cPDFEditArea);
+                                    commandData.EditType = CPDFEditType.EditPath;
+                                    if (commandData.EditAreaCopied)
+                                    {
+                                        List<CPDFCopyEditArea> copyList = editPage.GetCopyEditAreaList();
+                                        commandData.CopyArea = copyList[copyList.Count - 1];
+                                        commandData.EditPage = editPage;
+                                        lastPDFEditArgsList.Add(commandData);
+                                    }
+                                }
                             }
                         } 
                     }
@@ -574,6 +614,12 @@ namespace ComPDFKit.Tool
                     RemoveImageBlock();
                 }
 
+                if (currentEditAreaObject.cPDFEditArea.Type == CPDFEditType.EditPath)
+                {
+                    editType = CPDFEditType.EditPath;
+                    RemovePathBlock();
+                }
+
                 if (PDFViewer != null && PDFViewer.UndoManager != null)
                 {
                     PDFViewer.UndoManager.AddHistory(groupHistory);
@@ -617,6 +663,12 @@ namespace ComPDFKit.Tool
                                 editType = CPDFEditType.EditImage;
                                 RemoveImageBlock(editareaobject);
                             }
+
+                            if (editareaobject.cPDFEditArea.Type == CPDFEditType.EditPath)
+                            {
+                                editType = CPDFEditType.EditPath;
+                                RemovePathBlock(editareaobject);
+                            }
                         }
 
                         if (PDFViewer != null && PDFViewer.UndoManager != null)
@@ -829,6 +881,7 @@ namespace ComPDFKit.Tool
                         }
                     }
                 }
+
                 if (commandData.EditType == CPDFEditType.EditImage)
                 {
                     editType = CPDFEditType.EditImage;
@@ -836,7 +889,6 @@ namespace ComPDFKit.Tool
                     if (commandData.EditAreaCopied)
                     {
                         commandData.CopyArea?.PasteEditArea(editPage, new CPoint((float)offsetRect.Left, (float)offsetRect.Top));
-
                         editHistory.EditPage = editPage;
                         editHistory.PageIndex = pageIndex;
                         CPDFViewer pdfViewer = GetCPDFViewer();
@@ -885,6 +937,25 @@ namespace ComPDFKit.Tool
                     }
                 }
 
+                if (commandData.EditType == CPDFEditType.EditPath)
+                {
+                    editType = CPDFEditType.EditPath;
+                    PDFEditHistory editHistory = new PDFEditHistory();
+                    if (commandData.EditAreaCopied)
+                    {
+                        commandData.CopyArea?.PasteEditArea(editPage, new CPoint((float)offsetRect.Left, (float)offsetRect.Top));
+                        editHistory.EditPage = editPage;
+                        editHistory.PageIndex = pageIndex;
+                        CPDFViewer pdfViewer = GetCPDFViewer();
+                        if (pdfViewer != null && pdfViewer.UndoManager != null)
+                        {
+                            pdfViewer.UndoManager.AddHistory(editHistory);
+                        }
+
+                        SelectedEditAreaForIndex(pageIndex, editPage.GetEditAreaList().Count - 1, false);
+                    }
+                }
+
                 editPage.EndEdit();
             }
         }
@@ -1606,8 +1677,8 @@ namespace ComPDFKit.Tool
                 {
                     return;
                 }
-                AnnotParam annotParam = null;
 
+                AnnotParam annotParam = null;
                 if (cacheHitTestAnnot is BaseWidget)
                 {
                     annotParam = ParamConverter.WidgetConverter(PDFViewer.GetDocument(), cacheHitTestAnnot.GetAnnotData().Annot);
@@ -1616,6 +1687,7 @@ namespace ComPDFKit.Tool
                 {
                     annotParam = ParamConverter.AnnotConverter(PDFViewer.GetDocument(), cacheHitTestAnnot.GetAnnotData().Annot);
                 }
+
                 if (annotParam != null)
                 {
                     notifyData = new ExpandoObject();

+ 2 - 2
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.FindReplace.cs

@@ -102,7 +102,7 @@ namespace ComPDFKit.Tool
             // Start searching from the currently displayed page
             CPDFPage pdfPage = GetCPDFViewer().GetDocument().PageAtIndex(nextPageIndex);
             findSelectionEditPage = pdfPage.GetEditPage();
-            findSelectionEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            findSelectionEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
 
             // If the passed value is null, it will cause the program to freeze
             if (string.IsNullOrEmpty(findText))
@@ -328,7 +328,7 @@ namespace ComPDFKit.Tool
             {
                 CPDFPage page = PDFViewer.GetDocument().PageAtIndex(pageIndex);
                 CPDFEditPage editPage = page.GetEditPage();
-                editPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+                editPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
                 editPage.FindText(findText, options);
                 List<CPDFEditTextFindSelection> editTextFindSelectionList = editPage.GetTextFindSelectionList();
 

+ 6 - 7
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.MultiSelectedRect.cs

@@ -1,4 +1,5 @@
-using ComPDFKit.Tool.DrawTool;
+using ComPDFKit.PDFPage.Edit;
+using ComPDFKit.Tool.DrawTool;
 using ComPDFKit.Tool.Help;
 using ComPDFKit.Viewer.Layer;
 using System;
@@ -240,13 +241,16 @@ namespace ComPDFKit.Tool
                 editAreaMultiIndex.Clear();
                 //Delete Multiple Selection Record List
                 editAreaList.Clear();
+
+                cachePathList.Clear();
+                cachePathList = new List<CPDFEditPathArea>();
+                GetDrawPathList(Mouse.GetPosition(this));
             }
         }
 
         public void DrawStartSelectedMultiRect()
         {
             MultiSelectedRect multiSelectedRect = CommonHelper.FindVisualChild<MultiSelectedRect>(PDFViewer.GetViewForTag(MultiSelectedRectViewTag));
-
             if (multiSelectedRect != null)
             {
                 Point point = Mouse.GetPosition(this);
@@ -258,7 +262,6 @@ namespace ComPDFKit.Tool
         public void DrawMoveSelectedMultiRect()
         {
             MultiSelectedRect multiSelectedRect = CommonHelper.FindVisualChild<MultiSelectedRect>(PDFViewer.GetViewForTag(MultiSelectedRectViewTag));
-
             if (multiSelectedRect != null&& multiSelectedRect.Children.Count>0)
             {
                 Point point = Mouse.GetPosition(this);
@@ -269,7 +272,6 @@ namespace ComPDFKit.Tool
         public void DrawEndSelectedMultiRect()
         {
             MultiSelectedRect multiSelectedRect = CommonHelper.FindVisualChild<MultiSelectedRect>(PDFViewer.GetViewForTag(MultiSelectedRectViewTag));
-
             if (multiSelectedRect != null)
             {
                 Point point = Mouse.GetPosition(this);
@@ -285,9 +287,6 @@ namespace ComPDFKit.Tool
             {
                 multiSelectedRect.ClearDraw();
                 multiSelectedRect.CleanMulitSelectedRect();
-
-                Point point = Mouse.GetPosition(this);
-
                 switch (multiSelectedRect.GetSelectedType())
                 {
                     case SelectedType.Annot:

+ 242 - 86
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.TextEdit.cs

@@ -13,7 +13,6 @@ using ComPDFKitViewer.Helper;
 using ComPDFKitViewer.Layer;
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading;
@@ -112,7 +111,7 @@ namespace ComPDFKit.Tool
         private int selectedEditAreaIndex = -1;
         private bool selectAllCharsForLine = false;
         private CPoint rawHitPos;
-        private CPDFEditType contentEditType = CPDFEditType.EditText | CPDFEditType.EditImage;
+        private CPDFEditType contentEditType = CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath;
 
         /// <summary>
         /// Save Current Crop Box
@@ -151,6 +150,10 @@ namespace ComPDFKit.Tool
 
         private List<SelectedRect> text = new List<SelectedRect>();
 
+        private List<SelectedRect> path = new List<SelectedRect>();
+
+        private List<CPDFEditPathArea> cachePathList = new List<CPDFEditPathArea>();
+
         protected List<PointControlType> ignoreTextPoints { get; set; } = new List<PointControlType>();
 
         protected List<PointControlType> ignoreImagePoints { get; set; } = new List<PointControlType>();
@@ -234,6 +237,11 @@ namespace ComPDFKit.Tool
             selectedEditPageIndex = pageIndex;
             selectedEditAreaIndex = editAreaIndex;
             this.drawCaret = drawCaret;
+            //if ((pageIndex < 0 || editAreaIndex < 0) && cachePathList.Count != 0)
+            //{
+            //    cachePathList.Clear();
+            //    cachePathList = new List<CPDFEditPathArea>();
+            //}
         }
 
         /// <summary>
@@ -384,36 +392,40 @@ namespace ComPDFKit.Tool
             hitTestRects.Clear();
             image.Clear();
             text.Clear();
-            BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
+            path.Clear();
 
+            BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
             customizeLayer.Children.Clear();
             operateChildrenIndex = -1;
             CaretVisual caretVisual = new CaretVisual(GetDefaultDrawParam());
             customizeLayer.Children.Add(caretVisual);
-
-            currentZoom = currentRenderFrame.ZoomFactor;
-
             foreach (RenderData item in currentRenderFrame.GetRenderDatas())
             {
                 if (item.CPDFEditPageObj == null)
-                {
                     continue;
-                }
+
                 foreach (CPDFEditArea editArea in item.CPDFEditPageObj.GetEditAreaList())
                 {
+                    if (editArea is CPDFEditPathArea)
+                    {
+                        if (!cachePathList.Contains(editArea))
+                            continue;
+                    }
+
                     SelectedRect selectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
                     selectedRect.SetEditPen(editPen, editHoverPen);
                     selectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
                     customizeLayer.Children.Add(selectedRect);
 
-                    Rect TextBlock = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
+                    Rect editAreaRect = new Rect();
                     if (editArea.Type == CPDFEditType.EditImage)
                     {
                         if ((contentEditType & CPDFEditType.EditImage) != CPDFEditType.EditImage)
                         {
                             continue;
                         }
-                        TextBlock = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
+
+                        editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
                     }
                     else if (editArea.Type == CPDFEditType.EditText)
                     {
@@ -421,21 +433,35 @@ namespace ComPDFKit.Tool
                         {
                             continue;
                         }
+
+                        editAreaRect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
                     }
-                    Rect rect = TextBlock;
+                    else if (editArea.Type == CPDFEditType.EditPath)
+                    {
+                        if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
+                        {
+                            continue;
+                        }
 
-                    rect.X = (rect.X) * currentRenderFrame.ZoomFactor;
-                    rect.Y = (rect.Y) * currentRenderFrame.ZoomFactor;
-                    rect.Width *= currentRenderFrame.ZoomFactor;
-                    rect.Height *= currentRenderFrame.ZoomFactor;
-                    rect = DpiHelper.PDFRectToStandardRect(rect);
+                        editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
+                    }
 
-                    rect.X += item.PageBound.X;
-                    rect.Y += item.PageBound.Y;
+                    editAreaRect.X = (editAreaRect.X) * currentZoom;
+                    editAreaRect.Y = (editAreaRect.Y) * currentZoom;
+                    editAreaRect.Width *= currentZoom;
+                    editAreaRect.Height *= currentZoom;
+                    editAreaRect = DpiHelper.PDFRectToStandardRect(editAreaRect);
+                    editAreaRect.X += item.PageBound.X;
+                    editAreaRect.Y += item.PageBound.Y;
+
+                    if (editArea is CPDFEditPathArea)
+                    {
+                        selectedRect.RectMinHeight = 1;
+                        selectedRect.RectMinWidth = 1;
+                    }
 
-                    //PDF对象设置界面矩形
                     selectedRect.SetRectPadding(5);
-                    selectedRect.SetRect(rect, currentZoom);
+                    selectedRect.SetRect(editAreaRect, currentZoom);
                     selectedRect.SetMaxRect(item.PageBound);
                     selectedRect.SetIgnorePointsAll();
                     selectedRect.Draw();
@@ -459,13 +485,18 @@ namespace ComPDFKit.Tool
                         case CPDFEditType.EditImage:
                             image.Add(selectedRect);
                             break;
+                        case CPDFEditType.EditPath:
+                            path.Add(selectedRect);
+                            break;
                         default:
                             break;
                     }
                 }
             }
+
             hitTestRects.AddRange(text);
             hitTestRects.AddRange(image);
+            hitTestRects.AddRange(path);
         }
 
         public void DrawStartTextEdit(SelectedRect selectedRect, EditAreaObject editAreaObject)
@@ -759,6 +790,35 @@ namespace ComPDFKit.Tool
             return multiSelectedRect;
         }
 
+        private void GetDrawPathList(Point point)
+        {
+            if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
+                return;
+
+            PDFViewer.GetePointToPage(point, out RenderData renderData, out Point pagePoint);
+            pagePoint = new Point(pagePoint.X / currentZoom, pagePoint.Y / currentZoom);
+            if (renderData == null || renderData.CPDFEditPageObj == null)
+                return;
+
+            foreach (CPDFEditArea editArea in renderData.CPDFEditPageObj.GetEditAreaList())
+            {
+                if (editArea is CPDFEditPathArea)
+                {
+                    CPDFEditPathArea pathArea = editArea as CPDFEditPathArea;
+                    Rect rect = DataConversionForWPF.CRectConversionForRect(pathArea.GetClipRect());
+                    rect = DpiHelper.PDFRectToStandardRect(rect);
+                    if (rect.Contains(pagePoint))
+                    {
+                        if (cachePathList.Contains(pathArea) == false)
+                        {
+                            cachePathList.Add(pathArea);
+                            return;
+                        }
+                    }
+                }
+            }
+        }
+
         /// <summary>
         /// Select
         /// </summary>
@@ -773,6 +833,7 @@ namespace ComPDFKit.Tool
             SetPastePoint(new Point(-1, -1));
             SelectedEditAreaForIndex(-1, -1);
             Point point = Mouse.GetPosition(this);
+            //GetDrawPathList(point);
             CaretVisual caretVisual = CommonHelper.FindVisualChild<CaretVisual>(PDFViewer.GetViewForTag(textEditTag));
 
             EditAreaObject editAreaObject = null;
@@ -808,9 +869,9 @@ namespace ComPDFKit.Tool
                 }
                 else
                 {
-
                     pointControlType = rect.GetHitControlIndex(point);
                 }
+
                 editArea.TryGetValue(rect, out EditAreaObject editObject);
                 if (pointControlType != PointControlType.None)
                 {
@@ -954,7 +1015,6 @@ namespace ComPDFKit.Tool
                     lastSelectedRect.Draw();
                 }
 
-
                 if (editAreaObject.cPDFEditArea is CPDFEditTextArea)
                 {
                     string chars = (editAreaObject.cPDFEditArea as CPDFEditTextArea).GetAllChars();
@@ -966,16 +1026,27 @@ namespace ComPDFKit.Tool
                         lastSelectedRect.ClearDraw();
                     }
                 }
+
                 lastSelectedRect.DataChanged -= LastSelectedRect_DataChanged;
                 if (lastSelectedRect.GetCurrentDrawPointType() != DrawPointType.Crop)
                 {
                     lastSelectedRect = null;
                 }
+
+                //cachePathList.Clear();
+                //cachePathList = new List<CPDFEditPathArea>();
+                //GetDrawPathList(point);
             }
+
+            if(editAreaList.Count == 0)
+            {
+                cachePathList.Clear();
+                cachePathList = new List<CPDFEditPathArea>();
+                GetDrawPathList(point);
+            }
+
             caretVisual?.StopTimer();
             caretVisual?.CleanDraw();
-
-            return;
         }
 
         /// <summary>
@@ -1060,7 +1131,6 @@ namespace ComPDFKit.Tool
 
                 keyValuePairs.Add(currentEditAreaObject.PageIndex, OldRect);
                 DrawUpdateText(keyValuePairs, currentEditAreaObject.PageBound);
-
                 UpdateSelectRect(editAreaObject.cPDFEditArea);
 
                 // Move the moved selected box to the top layer of the selected logic
@@ -1074,10 +1144,19 @@ namespace ComPDFKit.Tool
                         image.Remove(selectedRect);
                         image.Insert(0, selectedRect);
                         break;
+                    case CPDFEditType.EditPath:
+                        path.Remove(selectedRect);
+                        path.Insert(0, selectedRect);
+                        break;
+
+                    default:
+                        break;
                 }
+
                 hitTestRects.Clear();
                 hitTestRects.AddRange(text);
                 hitTestRects.AddRange(image);
+                hitTestRects.AddRange(path);
             }
         }
 
@@ -1279,6 +1358,7 @@ namespace ComPDFKit.Tool
                     {
                         continue;
                     }
+
                     if (editAreaObject.cPDFEditArea is CPDFEditTextArea)
                     {
                         CPDFEditPage editPage = editAreaObject.cPDFEditPage;
@@ -1289,7 +1369,6 @@ namespace ComPDFKit.Tool
                         Rect.ClearDraw();
                     }
                 }
-                SelectedEditAreaForIndex(-1, -1);
             }
             else
             {
@@ -1298,15 +1377,13 @@ namespace ComPDFKit.Tool
                     if (areaObject.cPDFEditArea is CPDFEditTextArea)
                     {
                         CPDFEditPage editPage = areaObject.cPDFEditPage;
-                        CPDFEditTextArea textArea = areaObject.cPDFEditArea as CPDFEditTextArea;
-                        int index = areaObject.EditAreaIndex;
-                        editPage.RemoveEditArea(index);
+                        editPage.RemoveEditArea(areaObject.EditAreaIndex);
                         editPage.EndEdit();
-
                     }
                 }
-                SelectedEditAreaForIndex(-1, -1);
             }
+
+            SelectedEditAreaForIndex(-1, -1);
         }
 
         /// <summary>
@@ -1324,17 +1401,17 @@ namespace ComPDFKit.Tool
                     {
                         continue;
                     }
+
                     if (editAreaObject.cPDFEditArea is CPDFEditImageArea)
                     {
                         CPDFEditPage editPage = editAreaObject.cPDFEditPage;
-                        CPDFEditImageArea textArea = editAreaObject.cPDFEditArea as CPDFEditImageArea;
-                        int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(textArea);
+                        CPDFEditImageArea imageArea = editAreaObject.cPDFEditArea as CPDFEditImageArea;
+                        int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(imageArea);
                         editPage.RemoveEditArea(index);
                         editPage.EndEdit();
                         Rect.ClearDraw();
                     }
                 }
-                SelectedEditAreaForIndex(-1, -1);
             }
             else
             {
@@ -1343,14 +1420,51 @@ namespace ComPDFKit.Tool
                     if (areaObject.cPDFEditArea is CPDFEditImageArea)
                     {
                         CPDFEditPage editPage = areaObject.cPDFEditPage;
-                        CPDFEditImageArea textArea = areaObject.cPDFEditArea as CPDFEditImageArea;
-                        int index = areaObject.EditAreaIndex;
+                        editPage.RemoveEditArea(areaObject.EditAreaIndex);
+                        editPage.EndEdit();
+                    }
+                }
+            }
+
+            SelectedEditAreaForIndex(-1, -1);
+        }
+
+        public void RemovePathBlock(EditAreaObject areaObject = null)
+        {
+            if (currentEditAreaObject != null && currentEditAreaObject.cPDFEditPage != null)
+            {
+                foreach (var Rect in hitTestRects)
+                {
+                    editArea.TryGetValue(Rect, out EditAreaObject editAreaObject);
+                    if (editAreaObject != currentEditAreaObject)
+                    {
+                        continue;
+                    }
+                    if (editAreaObject.cPDFEditArea is CPDFEditPathArea)
+                    {
+                        CPDFEditPage editPage = editAreaObject.cPDFEditPage;
+                        CPDFEditPathArea pathArea = editAreaObject.cPDFEditArea as CPDFEditPathArea;
+                        int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(pathArea);
                         editPage.RemoveEditArea(index);
                         editPage.EndEdit();
+                        Rect.ClearDraw();
                     }
                 }
-                SelectedEditAreaForIndex(-1, -1);
             }
+            else
+            {
+                if (areaObject != null && areaObject.cPDFEditPage != null)
+                {
+                    if (areaObject.cPDFEditArea is CPDFEditPathArea)
+                    {
+                        CPDFEditPage editPage = areaObject.cPDFEditPage;
+                        editPage.RemoveEditArea(areaObject.EditAreaIndex);
+                        editPage.EndEdit();
+                    }
+                }
+            }
+
+            SelectedEditAreaForIndex(-1, -1);
         }
 
         public void CleanEditView()
@@ -1614,7 +1728,7 @@ namespace ComPDFKit.Tool
                         if (pointControlType != PointControlType.None)
                         {
                             EditAreaObject editAreaObject = GetEditAreaObjectForRect(rect);
-                            if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage)
+                            if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage || editAreaObject.cPDFEditArea.Type == CPDFEditType.EditPath)
                             {
                                 //image hover
                                 if (selectedRect1 == null)
@@ -1678,7 +1792,7 @@ namespace ComPDFKit.Tool
             return cursor;
         }
 
-        private Cursor GetCursors(PointControlType controlType, bool isImage)
+        private Cursor GetCursors(PointControlType controlType, bool notText)
         {
             switch (controlType)
             {
@@ -1699,7 +1813,7 @@ namespace ComPDFKit.Tool
                     return Cursors.SizeNS;
 
                 case PointControlType.Body:
-                    if (isImage)
+                    if (notText)
                     {
                         return Cursors.SizeAll;
                     }
@@ -1874,17 +1988,32 @@ namespace ComPDFKit.Tool
                     selectedRect = item.Key;
                 }
             }
+
             if (selectedRect != null)
             {
                 Rect maxrect = selectedRect.GetMaxRect();
-                Rect rect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
-                if (editArea.Type == CPDFEditType.EditImage)
+                Rect rect = new Rect();
+                if (editArea.Type == CPDFEditType.EditText)
+                {
+                    if ((contentEditType & CPDFEditType.EditText) == CPDFEditType.EditText)
+                    {
+                        rect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
+                    }
+                }
+                else if (editArea.Type == CPDFEditType.EditImage)
                 {
                     if ((contentEditType & CPDFEditType.EditImage) == CPDFEditType.EditImage)
                     {
                         rect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
                     }
                 }
+                else if (editArea.Type == CPDFEditType.EditPath)
+                {
+                    if ((contentEditType & CPDFEditType.EditPath) == CPDFEditType.EditPath)
+                    {
+                        rect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
+                    }
+                }
 
                 rect.X = (rect.X) * currentZoom;
                 rect.Y = (rect.Y) * currentZoom;
@@ -2003,7 +2132,6 @@ namespace ComPDFKit.Tool
             caretVisual.StopCaret();
         }
 
-
         /// <summary>
         /// Jump cursor to a specific position in a text area.
         /// </summary>
@@ -2174,61 +2302,89 @@ namespace ComPDFKit.Tool
         /// <param name="rectFrameSelect"></param>
         public void FrameSelectAddRect(Rect rectFrameSelect)
         {
-            if (rectFrameSelect.Width == 0 || rectFrameSelect.Height == 0)
-            {
+            if (rectFrameSelect.Width == 0 || rectFrameSelect.Height == 0 || PDFViewer.CurrentRenderFrame == null)
                 return;
-            }
-            if (PDFViewer.CurrentRenderFrame == null)
-            {
-                return;
-            }
+ 
             RenderFrame currentRenderFrame = PDFViewer.CurrentRenderFrame;
             BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
-
             customizeLayer.Children.Clear();
             CaretVisual caretVisual = new CaretVisual(GetDefaultDrawParam());
             customizeLayer.Children.Add(caretVisual);
 
-            currentZoom = currentRenderFrame.ZoomFactor;
             MultiSelectedRect multiSelectedRect = CommonHelper.FindVisualChild<MultiSelectedRect>(PDFViewer.GetViewForTag(MultiSelectedRectViewTag));
             foreach (RenderData item in currentRenderFrame.GetRenderDatas())
             {
-                if (item.PageIndex == FrameSelectPageIndex)
+                if (item.PageIndex == FrameSelectPageIndex && item.CPDFEditPageObj != null)
                 {
-                    if (item.CPDFEditPageObj == null)
-                    {
-                        continue;
-                    }
                     foreach (CPDFEditArea editArea in item.CPDFEditPageObj.GetEditAreaList())
                     {
-                        Rect TextBlock = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
+                        Rect editAreaRect = new Rect();
                         if (editArea.Type == CPDFEditType.EditImage)
                         {
                             if ((contentEditType & CPDFEditType.EditImage) != CPDFEditType.EditImage)
-                            {
                                 continue;
-                            }
-                            TextBlock = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
+                            
+                            editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
                         }
                         else if (editArea.Type == CPDFEditType.EditText)
                         {
                             if ((contentEditType & CPDFEditType.EditText) != CPDFEditType.EditText)
-                            {
                                 continue;
-                            }
+
+                            editAreaRect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
                         }
-                        Rect rect = TextBlock;
-                        if (rectFrameSelect.IntersectsWith(rect))
+                        else if (editArea.Type == CPDFEditType.EditPath)
                         {
-                            SelectedRect selectedRects = GetSelectedRectForEditAreaObject(editArea);
+                            if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
+                                continue;
+                            
+                            editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
+                        }
+
+                        if (rectFrameSelect.IntersectsWith(editAreaRect))
+                        {
+                            SelectedRect editAreaSelectedRect = GetSelectedRectForEditAreaObject(editArea);
+                            if(editAreaSelectedRect == null && editArea is CPDFEditPathArea)
+                            {
+                                cachePathList.Add(editArea as CPDFEditPathArea);
+
+                                editAreaRect.X = (editAreaRect.X) * currentZoom;
+                                editAreaRect.Y = (editAreaRect.Y) * currentZoom;
+                                editAreaRect.Width *= currentZoom;
+                                editAreaRect.Height *= currentZoom;
+                                editAreaRect = DpiHelper.PDFRectToStandardRect(editAreaRect);
+                                editAreaRect.X += item.PageBound.X;
+                                editAreaRect.Y += item.PageBound.Y;
+
+                                editAreaSelectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
+                                editAreaSelectedRect.SetEditPen(editPen, editHoverPen);
+                                editAreaSelectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
+                                customizeLayer.Children.Add(editAreaSelectedRect);
+
+                                editAreaSelectedRect.SetRectPadding(5);
+                                editAreaSelectedRect.SetRect(editAreaRect, currentZoom);
+                                editAreaSelectedRect.SetMaxRect(item.PageBound);
+                                editAreaSelectedRect.SetIgnorePointsAll();
+
+                                EditAreaObject editAreaObjects = new EditAreaObject();
+                                editAreaObjects.ControlType = PointControlType.None;
+                                editAreaObjects.cPDFEditArea = editArea;
+                                editAreaObjects.cPDFEditPage = item.CPDFEditPageObj;
+                                editAreaObjects.PageIndex = item.PageIndex;
+                                editAreaObjects.EditAreaIndex = item.CPDFEditPageObj.GetEditAreaList().IndexOf(editArea);
+                                editAreaObjects.PageBound = item.PageBound;
+                                editAreaObjects.PaintRect = item.PaintRect;
+
+                                this.editArea.Add(editAreaSelectedRect, editAreaObjects);
+                            }
                             SelectedRect selectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
                             selectedRect.SetEditPen(editPen, editHoverPen);
                             multiSelectedRect.SetSelectedType(SelectedType.PDFEdit);
                             selectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
-                            selectedRect.SetRect(selectedRects.GetRect(), currentZoom);
-                            selectedRect.SetMaxRect(selectedRects.GetMaxRect());
-                            EditAreaObject editAreaObject = null;
+                            selectedRect.SetRect(editAreaSelectedRect.GetRect(), currentZoom);
+                            selectedRect.SetMaxRect(editAreaSelectedRect.GetMaxRect());
 
+                            EditAreaObject editAreaObject = null;
                             foreach (var eitem in this.editArea)
                             {
                                 if (eitem.Value.cPDFEditArea == editArea)
@@ -2237,35 +2393,35 @@ namespace ComPDFKit.Tool
                                     break;
                                 }
                             }
+
                             int pageIndex = editAreaObject.PageIndex;
                             if (multiPage != pageIndex && editAreaList.Count > 0)
                             {
                                 foreach (int itemIndex in editAreaMultiIndex)
                                 {
-                                    SelectedRect OldRect = GetEditAreaForIndex(multiPage, itemIndex);
-                                    if (OldRect != null)
-                                    {
-                                        OldRect.Draw();
-                                    }
+                                    SelectedRect oldRect = GetEditAreaForIndex(multiPage, itemIndex);
+                                    oldRect?.Draw();
                                 }
+
                                 editAreaMultiIndex.Clear();
                                 multiSelectedRect.ClearDraw();
                                 multiSelectedRect.CleanMulitSelectedRect();
-                                multiPage = pageIndex;
                             }
-                            multiPage = editAreaObject.PageIndex;
+
+                            multiPage = pageIndex;
                             editAreaMultiIndex.Add(editAreaObject.EditAreaIndex);
                             editAreaList.Add(selectedRect, editAreaObject);
                             multiSelectedRect.Children.Add(selectedRect);
                             multiSelectedRect.SetMulitSelectedRect(selectedRect, editAreaObject.PageIndex, editAreaObject.EditAreaIndex);
 
-                            multiSelectedRect.SetRect(selectedRects.GetRect());
-                            multiSelectedRect.SetMaxRect(selectedRects.GetMaxRect());
+                            multiSelectedRect.SetRect(editAreaSelectedRect.GetRect());
+                            multiSelectedRect.SetMaxRect(editAreaSelectedRect.GetMaxRect());
                             multiSelectedRect.Draw();
                         }
                     }
                 }
             }
+
             PDFViewer.UpdateRenderFrame();
         }
 
@@ -2362,7 +2518,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2422,7 +2578,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2495,7 +2651,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2570,7 +2726,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2630,7 +2786,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2687,7 +2843,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
             {
                 SelectedRect item = checkItem;
@@ -2746,7 +2902,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect item in MultiSelectEditList.GetMulitSelectList())
             {
                 Rect rect = item.GetRect();
@@ -2809,7 +2965,7 @@ namespace ComPDFKit.Tool
             CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
             CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
             CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
-            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
+            cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             foreach (SelectedRect item in MultiSelectEditList.GetMulitSelectList())
             {
                 Rect rect = item.GetRect();

+ 4 - 4
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

@@ -46,6 +46,7 @@ namespace ComPDFKit.Tool
         Widget,
         TextEdit,
         ImageEdit,
+        PathEdit,
         ImageSelect,
         MultiTextEdit,
         SelectedPageRect,
@@ -127,8 +128,6 @@ namespace ComPDFKit.Tool
         private bool isMultiSelected;
         private bool isDocumentModified = false;
 
-
-
         public bool CanAddTextEdit = true;
 
         protected bool isContinueCreateTextEdit = false;
@@ -144,7 +143,6 @@ namespace ComPDFKit.Tool
         /// <param name="isContinueCreateTextEdit"></param>
         public void SetContinueCreateTextEdit(bool isContinueCreateTextEdit)
         {
-
             this.isContinueCreateTextEdit = isContinueCreateTextEdit;
             CanAddTextEdit = true;
         }
@@ -324,7 +322,6 @@ namespace ComPDFKit.Tool
         {
             if (isContinueCreateTextEdit)
             {
-
                 if (lastSelectedRect != null)
                 {
                     CanAddTextEdit = false;
@@ -863,6 +860,9 @@ namespace ComPDFKit.Tool
                             case CPDFEditType.EditImage:
                                 mouseEventObject.hitTestType = MouseHitTestType.ImageEdit;
                                 break;
+                            case CPDFEditType.EditPath:
+                                mouseEventObject.hitTestType = MouseHitTestType.PathEdit;
+                                break;
                             default:
                                 break;
                         }

+ 1 - 0
Demo/Examples/ComPDFKit.Tool/ComPDFKit.Tool.csproj

@@ -162,6 +162,7 @@
     <Compile Include="SettingParam\FormParam\PushButtonParam.cs" />
     <Compile Include="SettingParam\FormParam\RadioButtonParam.cs" />
     <Compile Include="SettingParam\FormParam\TextBoxParam.cs" />
+    <Compile Include="SettingParam\PDFEditParam\PathEditParam.cs" />
     <Compile Include="SettingParam\PDFEditParam\ImageEditParam.cs" />
     <Compile Include="SettingParam\PDFEditParam\PDFEditParam.cs" />
     <Compile Include="SettingParam\PDFEditParam\TextEditParam.cs" />

+ 2 - 2
Demo/Examples/ComPDFKit.Tool/DrawTool/SelectedRect.cs

@@ -509,7 +509,7 @@ namespace ComPDFKit.Tool.DrawTool
             {
                 return;
             }
-            newRect = new Rect((int)(newRect.X - rectPadding * zoom), (int)(newRect.Y - rectPadding * zoom), (int)(newRect.Width + 2 * rectPadding * zoom), (int)(newRect.Height + 2 * rectPadding * zoom));
+            newRect = new Rect((newRect.X - rectPadding * zoom), (newRect.Y - rectPadding * zoom), (newRect.Width + 2 * rectPadding * zoom), (newRect.Height + 2 * rectPadding * zoom));
             currentZoom = zoom;
             SetDrawRect = drawRect = newRect;
             drawCenterPoint = new Point(drawRect.Left + drawRect.Width / 2, drawRect.Top + drawRect.Height / 2);
@@ -523,7 +523,7 @@ namespace ComPDFKit.Tool.DrawTool
         /// </param>
         public Rect GetRect() 
         {
-            Rect rect = new Rect(drawRect.X + rectPadding * currentZoom, drawRect.Y + rectPadding * currentZoom, Math.Max(rectMinWidth, drawRect.Width - 2 * rectPadding * currentZoom), Math.Max(RectMinHeight, drawRect.Height - 2 * rectPadding * currentZoom));
+            Rect rect = new Rect(drawRect.X + rectPadding * currentZoom, drawRect.Y + rectPadding * currentZoom, Math.Max(RectMinWidth, drawRect.Width - 2 * rectPadding * currentZoom), Math.Max(RectMinHeight, drawRect.Height - 2 * rectPadding * currentZoom));
             return rect;
         }
 

+ 7 - 17
Demo/Examples/ComPDFKit.Tool/DrawTool/SelectedRect.protected.cs

@@ -1,8 +1,7 @@
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
+using System.Linq;
 using System.Windows;
-using System.Windows.Input;
 using System.Windows.Media;
 
 namespace ComPDFKit.Tool.DrawTool
@@ -62,12 +61,12 @@ namespace ComPDFKit.Tool.DrawTool
         /// <summary>
         /// Rectangular minimum width.
         /// </summary>
-        protected int rectMinWidth { get; set; } = 10;
+        public int RectMinWidth { get; set; } = 10;
 
         /// <summary>
         /// Rectangular minimum height.
         /// </summary>
-        protected int RectMinHeight { get; set; } = 10;
+        public int RectMinHeight { get; set; } = 10;
 
         /// <summary>
         /// Current set of ignore points.
@@ -286,11 +285,10 @@ namespace ComPDFKit.Tool.DrawTool
             isOutSideScaling = IsOutSideScaling;
         }
 
-
         private Size GetProportionalScalingSize(double width, double height)
         {
             double minHeight = RectMinHeight + 2 * rectPadding * currentZoom;
-            double minWidth = rectMinWidth + 2 * rectPadding * currentZoom;
+            double minWidth = RectMinWidth + 2 * rectPadding * currentZoom;
             if (minWidth > width || minHeight > height)
             {
                 if (cacheRect.Width >= cacheRect.Height)
@@ -329,7 +327,7 @@ namespace ComPDFKit.Tool.DrawTool
             {
                 double left = 0, right = 0, top = 0, bottom = 0;
                 double minHeight = RectMinHeight + 2 * rectPadding * currentZoom;
-                double minWidth = rectMinWidth + 2 * rectPadding * currentZoom;
+                double minWidth = RectMinWidth + 2 * rectPadding * currentZoom;
 
                 Point centerPoint = new Point((cacheRect.Right + cacheRect.Left) / 2, (cacheRect.Bottom + cacheRect.Top) / 2);
                 Point moveVector = (Point)(mousePoint - centerPoint);
@@ -481,7 +479,7 @@ namespace ComPDFKit.Tool.DrawTool
                                 }
                             }
                             else
-                            {
+                            { 
                                 if (left + minWidth > right)
                                 {
                                     right = left + minWidth;
@@ -621,7 +619,7 @@ namespace ComPDFKit.Tool.DrawTool
             {
                 double left = 0, right = 0, top = 0, bottom = 0;
                 double minHeight = RectMinHeight + 2 * rectPadding * currentZoom;
-                double minWidth = rectMinWidth + 2 * rectPadding * currentZoom;
+                double minWidth = RectMinWidth + 2 * rectPadding * currentZoom;
 
                 Point centerPoint = new Point((cacheRect.Right + cacheRect.Left) / 2, (cacheRect.Bottom + cacheRect.Top) / 2);
                 Point moveVector = (Point)(mousePoint - centerPoint);
@@ -1035,7 +1033,6 @@ namespace ComPDFKit.Tool.DrawTool
         /// </param>
         protected void DrawSquarePoint(DrawingContext drawingContext, List<PointControlType> ignoreList, int PointSize, Pen PointPen, SolidColorBrush BorderBrush)
         {
-
             RotateTransform rotateTransform = new RotateTransform(rotateAngle, centerPoint.X, centerPoint.Y);
             if (canRotation && !isInScaling)
             {
@@ -1043,20 +1040,15 @@ namespace ComPDFKit.Tool.DrawTool
                 GeometryGroup rotateGroup = new GeometryGroup();
 
                 double angleInRadians = rotateAngle * (Math.PI / 180);
-
                 double sinValue = Math.Sin(angleInRadians);
                 double cosValue = Math.Cos(angleInRadians);
-
                 double rotatedX = currentRotationPoint.X - pointSize * sinValue;
                 double rotatedY = currentRotationPoint.Y + pointSize * cosValue;
 
                 LineGeometry moveLineGeometry = new LineGeometry(centerPoint, new Point(rotatedX, rotatedY));
-
                 EllipseGeometry ellipseGeometry = new EllipseGeometry(currentRotationPoint, PointSize, pointSize);
-
                 rotateGroup.Children.Add(moveLineGeometry);
                 rotateGroup.Children.Add(ellipseGeometry);
-
                 if (!isInRotate)
                 {
                     rotateGroup.Children.Remove(moveLineGeometry);
@@ -1066,7 +1058,6 @@ namespace ComPDFKit.Tool.DrawTool
                 }
 
                 drawingContext?.DrawGeometry(BorderBrush, PointPen, rotateGroup);
-
                 if (!isInRotate)
                 {
 
@@ -1299,7 +1290,6 @@ namespace ComPDFKit.Tool.DrawTool
             Draw();
         }
 
-
         /// <summary>
         /// Get the current set of ignore points
         /// </summary>

+ 32 - 18
Demo/Examples/ComPDFKit.Tool/Help/ParamConverter.cs

@@ -9,7 +9,6 @@ using ComPDFKit.PDFPage.Edit;
 using ComPDFKit.Tool.SettingParam;
 using ComPDFKit.Tool.UndoManger;
 using ComPDFKit.Viewer.Helper;
-using ComPDFKitViewer.Annot;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -312,10 +311,10 @@ namespace ComPDFKit.Tool.Help
             return annotParam;
         }
 
-        public static PDFEditParam CPDFDataConverterToPDFEitParam(CPDFDocument cPDFDocument, CPDFEditArea cPDFEditArea, int PageIndex)
+        public static PDFEditParam CPDFDataConverterToPDFEitParam(CPDFDocument cPDFDocument, CPDFEditArea cPDFEditArea, int pageIndex)
         {
             PDFEditParam annotParam = null;
-            if (cPDFEditArea == null && !cPDFEditArea.IsValid() && cPDFDocument == null && !cPDFDocument.IsValid() && PageIndex >= 0)
+            if (cPDFEditArea == null && !cPDFEditArea.IsValid() && cPDFDocument == null && !cPDFDocument.IsValid() && pageIndex >= 0)
             {
                 return null;
             }
@@ -324,11 +323,15 @@ namespace ComPDFKit.Tool.Help
                 case CPDFEditType.None:
                     break;
                 case CPDFEditType.EditText:
-                    annotParam = GetTextEditParam(cPDFDocument, cPDFEditArea as CPDFEditTextArea, PageIndex);
+                    annotParam = GetTextEditParam(cPDFDocument, cPDFEditArea as CPDFEditTextArea, pageIndex);
                     break;
                 case CPDFEditType.EditImage:
-                    annotParam = GetImageEditParam(cPDFDocument, cPDFEditArea as CPDFEditImageArea, PageIndex);
+                    annotParam = GetImageEditParam(cPDFDocument, cPDFEditArea as CPDFEditImageArea, pageIndex);
                     break;
+                case CPDFEditType.EditPath:
+                    annotParam = GetPathEditParam(cPDFDocument, cPDFEditArea as CPDFEditPathArea, pageIndex);
+                    break;
+
                 default:
                     break;
             }
@@ -338,7 +341,7 @@ namespace ComPDFKit.Tool.Help
 
         #region PDFEdit
 
-        internal static TextEditParam GetTextEditParam(CPDFDocument cPDFDocument, CPDFEditTextArea cPDFEditArea, int PageIndex)
+        internal static TextEditParam GetTextEditParam(CPDFDocument cPDFDocument, CPDFEditTextArea cPDFEditArea, int pageIndex)
         {
             TextEditParam textEditParam = new TextEditParam();
             string fontName = "Helvetica";
@@ -355,10 +358,10 @@ namespace ComPDFKit.Tool.Help
             textEditParam.Transparency = transparency;
             textEditParam.TextAlign = cPDFEditArea.GetTextSectionAlign();
             textEditParam.EditType = CPDFEditType.EditText;
-            CPDFPage docPage = cPDFDocument.PageAtIndex(PageIndex);
-            CPDFEditPage EditPage = docPage.GetEditPage();
-            textEditParam.EditIndex = EditPage.GetEditAreaList().IndexOf(cPDFEditArea);
-            textEditParam.PageIndex = PageIndex;
+            CPDFPage docPage = cPDFDocument.PageAtIndex(pageIndex);
+            CPDFEditPage editPage = docPage.GetEditPage();
+            textEditParam.EditIndex = editPage.GetEditAreaList().IndexOf(cPDFEditArea);
+            textEditParam.PageIndex = pageIndex;
 
             if(string.IsNullOrEmpty(cPDFEditArea.SelectText))
             {
@@ -374,18 +377,30 @@ namespace ComPDFKit.Tool.Help
             return textEditParam;
         }
 
-        internal static ImageEditParam GetImageEditParam(CPDFDocument cPDFDocument, CPDFEditImageArea cPDFEditArea, int PageIndex)
+        internal static ImageEditParam GetImageEditParam(CPDFDocument cPDFDocument, CPDFEditImageArea cPDFEditArea, int pageIndex)
         {
             ImageEditParam imageEditParam = new ImageEditParam();
             imageEditParam.Transparency = cPDFEditArea.GetImageTransparency();
             imageEditParam.EditType = CPDFEditType.EditImage;
-            CPDFPage docPage = cPDFDocument.PageAtIndex(PageIndex);
-            CPDFEditPage EditPage = docPage.GetEditPage();
-            imageEditParam.EditIndex = EditPage.GetEditAreaList().IndexOf(cPDFEditArea);
-            imageEditParam.PageIndex = PageIndex;
+            CPDFPage docPage = cPDFDocument.PageAtIndex(pageIndex);
+            CPDFEditPage editPage = docPage.GetEditPage();
+            imageEditParam.EditIndex = editPage.GetEditAreaList().IndexOf(cPDFEditArea);
+            imageEditParam.PageIndex = pageIndex;
             return imageEditParam;
         }
 
+        internal static PathEditParam GetPathEditParam(CPDFDocument cPDFDocument, CPDFEditPathArea cPDFEditArea, int pageIndex)
+        {
+            PathEditParam pathEditParam = new PathEditParam();
+            pathEditParam.Transparency = cPDFEditArea.GetTransparency();
+            pathEditParam.EditType = CPDFEditType.EditImage;
+            CPDFPage docPage = cPDFDocument.PageAtIndex(pageIndex);
+            CPDFEditPage editPage = docPage.GetEditPage();
+            pathEditParam.EditIndex = editPage.GetEditAreaList().IndexOf(cPDFEditArea);
+            pathEditParam.PageIndex = pageIndex;
+            return pathEditParam;
+        }
+
         #endregion
 
         #region Widegt
@@ -976,6 +991,7 @@ namespace ComPDFKit.Tool.Help
             {
                 annotParam.AnnotIndex = pdfAnnot.Page.GetAnnotCount() - 1;
             }
+
             annotParam.PageIndex = pdfAnnot.Page.PageIndex;
         }
 
@@ -1566,7 +1582,6 @@ namespace ComPDFKit.Tool.Help
             }
 
             StampParam stampParam = new StampParam();
-
             C_STAMP_TYPE stampType = stampAnnot.GetStampType();
             switch (stampType)
             {
@@ -1596,6 +1611,7 @@ namespace ComPDFKit.Tool.Help
                     }
                     break;
                 case C_STAMP_TYPE.IMAGE_STAMP:
+                case C_STAMP_TYPE.UNKNOWN_STAMP:
                     {
                         stampParam.StampType = stampType;
                         CRect rawRect = stampAnnot.GetRect();
@@ -1634,7 +1650,6 @@ namespace ComPDFKit.Tool.Help
             }
 
             GetAnnotCommonParam(stampAnnot, stampParam);
-
             return stampParam;
         }
 
@@ -1646,7 +1661,6 @@ namespace ComPDFKit.Tool.Help
             }
 
             LinkParam linkParam = new LinkParam();
-
             CPDFAction linkAction = linkAnnot.GetLinkAction();
             if (linkAction != null)
             {

+ 1 - 10
Demo/Examples/ComPDFKit.Tool/SettingParam/PDFEditParam/ImageEditParam.cs

@@ -15,20 +15,11 @@ namespace ComPDFKit.Tool
         public override bool CopyTo(PDFEditParam transfer)
         {
             ImageEditParam imageTransfer = transfer as ImageEditParam;
-            if (imageTransfer == null)
-            {
+            if (imageTransfer == null || !base.CopyTo(imageTransfer))
                 return false;
-            }
 
-            if (!base.CopyTo(imageTransfer))
-            {
-                return false;
-            }
-
-           
             imageTransfer.ClipRect = ClipRect;
             imageTransfer.Rotate = Rotate;
-
             return true;
         }
     }

+ 1 - 3
Demo/Examples/ComPDFKit.Tool/SettingParam/PDFEditParam/PDFEditParam.cs

@@ -13,15 +13,13 @@ namespace ComPDFKit.Tool
         public virtual bool CopyTo(PDFEditParam transfer)
         {
             if (transfer == null)
-            {
                 return false;
-            }
+
             transfer.PageIndex = PageIndex;
             transfer.EditIndex = EditIndex;
             transfer.EditType = EditType;
             transfer.Transparency = Transparency;
             transfer.ClientRect = ClientRect;
-
             return true;
         }
     }

+ 26 - 0
Demo/Examples/ComPDFKit.Tool/SettingParam/PDFEditParam/PathEditParam.cs

@@ -0,0 +1,26 @@
+using ComPDFKit.Import;
+using ComPDFKit.PDFPage;
+
+namespace ComPDFKit.Tool
+{
+    public class PathEditParam:PDFEditParam
+    {
+        public PathEditParam() 
+        {
+            EditType = CPDFEditType.EditPath;
+        }
+        public CRect ClipRect { get; set; }
+        public int Rotate { get; set; }
+
+        public override bool CopyTo(PDFEditParam transfer)
+        {
+            PathEditParam pathTransfer = transfer as PathEditParam;
+            if (pathTransfer == null || !base.CopyTo(pathTransfer))
+                return false;
+
+            pathTransfer.ClipRect = ClipRect;
+            pathTransfer.Rotate = Rotate;
+            return true;
+        }
+    }
+}

+ 2 - 11
Demo/Examples/ComPDFKit.Tool/SettingParam/PDFEditParam/TextEditParam.cs

@@ -19,26 +19,17 @@ namespace ComPDFKit.Tool
         public override bool CopyTo(PDFEditParam transfer)
         {
             TextEditParam texteditTransfer = transfer as TextEditParam;
-            if (texteditTransfer == null)
-            {
+            if (texteditTransfer == null || !base.CopyTo(texteditTransfer))
                 return false;
-            }
-
-            if (!base.CopyTo(texteditTransfer))
-            {
-                return false;
-            }
 
             texteditTransfer.FontSize = FontSize;
             if (FontColor != null)
-            {
                 texteditTransfer.FontColor = (byte[])FontColor.Clone();
-            }
+
             texteditTransfer.TextAlign = TextAlign;
             texteditTransfer.FontName = FontName;
             texteditTransfer.IsItalic = IsItalic;
             texteditTransfer.IsBold = IsBold;
-
             return true;
         }
     }

+ 150 - 81
Demo/Examples/Compdfkit.Controls/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -152,7 +152,7 @@ namespace ComPDFKit.Controls.PDFControl
             }
 
             PdfViewControl.PDFToolManager.SetCreateContentEditType(CPDFEditType.None);
-            PdfViewControl.PDFViewTool.SetCurrentEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
+            PdfViewControl.PDFViewTool.SetCurrentEditType(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
             PdfViewControl.PDFViewTool.GetCPDFViewer().SetIsVisibleCustomMouse(false);
             PdfViewControl.PDFViewTool.GetCPDFViewer().SetIsShowStampMouse(false);
             PdfViewControl.PDFViewTool.SelectedEditAreaForIndex(-1, -1);
@@ -253,33 +253,34 @@ namespace ComPDFKit.Controls.PDFControl
                 return;
             }
 
+            Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
             if (Keyboard.Modifiers == ModifierKeys.Control)
             {
                 if (e.Key == Key.Left)
                 {
                     textArea.GetPreWordCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Right)
                 {
                     textArea.GetNextWordCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Up)
                 {
                     textArea.GetSectionBeginCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
                 if (e.Key == Key.Down)
                 {
                     textArea.GetSectionEndCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
             }
@@ -296,7 +297,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetPrevCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -305,7 +306,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetNextCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -314,7 +315,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetUpCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -323,7 +324,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetDownCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
             }
@@ -333,14 +334,14 @@ namespace ComPDFKit.Controls.PDFControl
                 if (e.SystemKey == Key.Up)
                 {
                     textArea.GetLineBeginCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
                 if (e.SystemKey == Key.Down)
                 {
                     textArea.GetLineEndCharPlace();
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
             }
@@ -390,7 +391,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetPreWordCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -399,7 +400,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetNextWordCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -408,7 +409,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetSectionBeginCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
 
@@ -417,7 +418,7 @@ namespace ComPDFKit.Controls.PDFControl
                     textArea.GetSectionEndCharPlace();
                     endPoint = GetPoint(textArea);
                     textArea.GetSelectChars(startPoint, endPoint);
-                    UpdateTextArea(textArea);
+                    UpdateEditArea(oldRect, textArea);
                     e.Handled = true;
                 }
             }
@@ -594,21 +595,11 @@ namespace ComPDFKit.Controls.PDFControl
         }
 
         /// <summary>
-        /// Update the text appearance after the text area is changed
-        /// </summary> 
-        private void UpdateTextArea(CPDFEditTextArea textArea)
-        {
-            Rect oldRect = DataConversionForWPF.CRectConversionForRect(textArea.GetFrame());
-            PdfViewControl.PDFViewTool.UpdateRender(oldRect, textArea);
-        }
-
-        /// <summary>
-        /// Update the image appearance after the image area is changed
+        /// Update the edit area appearance after the edit area is changed
         /// </summary> 
-        private void UpdateImageArea(CPDFEditImageArea imageArea)
+        private void UpdateEditArea(Rect oldRect, CPDFEditArea editArea)
         {
-            Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
-            PdfViewControl.PDFViewTool.UpdateRender(oldRect, imageArea);
+            PdfViewControl.PDFViewTool.UpdateRender(oldRect, editArea);
         }
 
         private void PdfViewControl_MouseRightButtonDownHandler(object sender, MouseEventObject e)
@@ -626,6 +617,9 @@ namespace ComPDFKit.Controls.PDFControl
                 case MouseHitTestType.ImageEdit:
                     CreateImageEditMenu(sender, ref ContextMenu);
                     break;
+                case MouseHitTestType.PathEdit:
+                    CreatePathEditMenu(sender, ref ContextMenu);
+                    break;
                 case MouseHitTestType.Unknown:
                     List<int> pageInts = new List<int>();
                     List<CPDFEditArea> editAreas = PdfViewControl.PDFToolManager.GetSelectedEditAreaListObject(ref pageInts);
@@ -669,11 +663,15 @@ namespace ComPDFKit.Controls.PDFControl
 
         private void AppendOpacityMenu(MenuItem parentMenu, CPDFEditArea editArea, CPDFEditType editType)
         {
+            if (editArea == null)
+                return;
+
             List<int> opacityList = new List<int>()
             {
                 25,50,75,100
             };
 
+            Rect oldRect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
             foreach (int opacity in opacityList)
             {
                 MenuItem opacityMenu = new MenuItem();
@@ -685,16 +683,22 @@ namespace ComPDFKit.Controls.PDFControl
                         CPDFEditImageArea editImageArea = editArea as CPDFEditImageArea;
                         editImageArea?.SetImageTransparency((byte)Math.Ceiling(opacity * 255 / 100D));
                         pdfContentEditControl.RefreshThumb();
-                        UpdateImageArea(editImageArea);
+                        UpdateEditArea(oldRect, editImageArea);
                     }
                     else if (editArea != null && editType == CPDFEditType.EditText)
                     {
                         CPDFEditTextArea editTextArea = editArea as CPDFEditTextArea;
                         editTextArea?.SetCharsFontTransparency((byte)Math.Ceiling(opacity * 255 / 100D));
-                        pdfContentEditControl.RefreshThumb();
-                        UpdateTextArea(editTextArea);
+                        UpdateEditArea(oldRect, editTextArea);
+                    }
+                    else if (editArea != null && editType == CPDFEditType.EditPath)
+                    {
+                        CPDFEditPathArea editPathArea = editArea as CPDFEditPathArea;
+                        editPathArea?.SetTransparency((byte)Math.Ceiling(opacity * 255 / 100D));
+                        UpdateEditArea(oldRect, editPathArea);
                     }
                 };
+
                 parentMenu.Items.Add(opacityMenu);
             }
         }
@@ -732,6 +736,9 @@ namespace ComPDFKit.Controls.PDFControl
             else if (editAreas != null && editAreas.Count != 0)
             {
                 List<CPDFEditTextArea> editTextAreas = editAreas.OfType<CPDFEditTextArea>().ToList();
+                List<CPDFEditImageArea> editImageAreas = editAreas.OfType<CPDFEditImageArea>().ToList();
+                List<CPDFEditPathArea> editPathAreas = editAreas.OfType<CPDFEditPathArea>().ToList();
+
                 editTextAreas.ForEach(textArea => textArea.SelectAllChars());
                 if (editAreas.Count == editTextAreas.Count)
                 {
@@ -741,7 +748,7 @@ namespace ComPDFKit.Controls.PDFControl
                     pdfContentEditControl.SetPDFTextEditData(editParams, true);
                     PropertyContainer.Child = pdfContentEditControl;
                 }
-                else if (editTextAreas.Count == 0)
+                else if (editTextAreas.Count == 0 && editPathAreas.Count == 0)
                 {
                     List<ImageEditParam> editParams = editAreas.
                         Select(area => ParamConverter.CPDFDataConverterToPDFEitParam(PdfViewControl.PDFToolManager.GetDocument(), area, pageInts.FirstOrDefault())).
@@ -787,7 +794,6 @@ namespace ComPDFKit.Controls.PDFControl
                     pdfContentEditControl.SetPDFTextEditData(new List<TextEditParam> { (TextEditParam)pDFEditParam }, true);
                     PropertyContainer.Child = pdfContentEditControl;
                 }
-
                 else if (editAreaArea.Type == CPDFEditType.EditImage && PdfViewControl != null)
                 {
                     UIElement pageView = sender as UIElement;
@@ -800,11 +806,6 @@ namespace ComPDFKit.Controls.PDFControl
                     pdfContentEditControl.SetPDFImageEditData(new List<ImageEditParam> { (ImageEditParam)pDFEditParam });
                     PropertyContainer.Child = pdfContentEditControl;
                 }
-
-                else
-                {
-
-                }
             }
         }
 
@@ -878,17 +879,22 @@ namespace ComPDFKit.Controls.PDFControl
         {
             int index = -1;
             CPDFEditImageArea imageArea = PdfViewControl.PDFToolManager.GetSelectedEditAreaObject(ref index) as CPDFEditImageArea;
+            if (imageArea == null)
+                return;
+
+            menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+            menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+            menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+            menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
 
             MenuItem rotateLeftMenu = new MenuItem();
             rotateLeftMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateLeft");
             rotateLeftMenu.Click += (o, p) =>
             {
-                if (imageArea != null)
-                {
-                    imageArea.Rotate(-90);
-                    pdfContentEditControl.RefreshThumb();
-                    UpdateImageArea(imageArea);
-                }
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
+                imageArea.Rotate(-90);
+                pdfContentEditControl.RefreshThumb();
+                UpdateEditArea(oldRect,imageArea);
             };
             menu.Items.Add(rotateLeftMenu);
 
@@ -896,12 +902,10 @@ namespace ComPDFKit.Controls.PDFControl
             rotateRightMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateRight");
             rotateRightMenu.Click += (o, p) =>
             {
-                if (imageArea != null)
-                {
+                    Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
                     imageArea.Rotate(90);
                     pdfContentEditControl.RefreshThumb();
-                    UpdateImageArea(imageArea);
-                }
+                    UpdateEditArea(oldRect, imageArea);
             };
             menu.Items.Add(rotateRightMenu);
 
@@ -909,42 +913,40 @@ namespace ComPDFKit.Controls.PDFControl
             replaceMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Replace");
             replaceMenu.Click += (o, p) =>
             {
-                if (imageArea != null)
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                if (openFileDialog.ShowDialog() == true)
                 {
-                    OpenFileDialog openFileDialog = new OpenFileDialog();
-                    openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
-                    if (openFileDialog.ShowDialog() == true)
-                    {
-                        int imageWidth = 0;
-                        int imageHeight = 0;
-                        byte[] imageData = null;
+                    int imageWidth = 0;
+                    int imageHeight = 0;
+                    byte[] imageData = null;
 
-                        BitmapFrame frame = null;
-                        BitmapDecoder decoder = BitmapDecoder.Create(new Uri(openFileDialog.FileName), BitmapCreateOptions.None, BitmapCacheOption.Default);
-                        if (decoder.Frames.Count > 0)
+                    BitmapFrame frame = null;
+                    BitmapDecoder decoder = BitmapDecoder.Create(new Uri(openFileDialog.FileName), BitmapCreateOptions.None, BitmapCacheOption.Default);
+                    if (decoder.Frames.Count > 0)
+                    {
+                        frame = decoder.Frames[0];
+                    }
+                    if (frame != null)
+                    {
+                        imageData = new byte[frame.PixelWidth * frame.PixelHeight * 4];
+                        if (frame.Format != PixelFormats.Bgra32)
                         {
-                            frame = decoder.Frames[0];
+                            FormatConvertedBitmap covert = new FormatConvertedBitmap(frame, PixelFormats.Bgra32, frame.Palette, 0);
+                            covert.CopyPixels(imageData, frame.PixelWidth * 4, 0);
                         }
-                        if (frame != null)
+                        else
                         {
-                            imageData = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                            if (frame.Format != PixelFormats.Bgra32)
-                            {
-                                FormatConvertedBitmap covert = new FormatConvertedBitmap(frame, PixelFormats.Bgra32, frame.Palette, 0);
-                                covert.CopyPixels(imageData, frame.PixelWidth * 4, 0);
-                            }
-                            else
-                            {
-                                frame.CopyPixels(imageData, frame.PixelWidth * 4, 0);
-                            }
-                            imageWidth = frame.PixelWidth;
-                            imageHeight = frame.PixelHeight;
+                            frame.CopyPixels(imageData, frame.PixelWidth * 4, 0);
                         }
-
-                        imageArea.ReplaceImageArea(imageArea.GetFrame(), imageData, imageWidth, imageHeight);
-                        pdfContentEditControl.RefreshThumb();
-                        UpdateImageArea(imageArea);
+                        imageWidth = frame.PixelWidth;
+                        imageHeight = frame.PixelHeight;
                     }
+
+                    Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
+                    imageArea.ReplaceImageArea(imageArea.GetFrame(), imageData, imageWidth, imageHeight);
+                    pdfContentEditControl.RefreshThumb();
+                    UpdateEditArea(oldRect, imageArea);
                 }
             };
             menu.Items.Add(replaceMenu);
@@ -989,9 +991,10 @@ namespace ComPDFKit.Controls.PDFControl
             horizonMirror.Header = LanguageHelper.CommonManager.GetString("Menu_HFlip");
             horizonMirror.Click += (o, p) =>
             {
-                imageArea?.HorizontalMirror();
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
+                imageArea.HorizontalMirror();
                 pdfContentEditControl.RefreshThumb();
-                UpdateImageArea(imageArea);
+                UpdateEditArea(oldRect, imageArea);
             };
             menu.Items.Add(horizonMirror);
 
@@ -1001,9 +1004,10 @@ namespace ComPDFKit.Controls.PDFControl
             {
                 if (imageArea != null)
                 {
-                    imageArea?.VerticalMirror();
+                    Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
+                    imageArea.VerticalMirror();
                     pdfContentEditControl.RefreshThumb();
-                    UpdateImageArea(imageArea);
+                    UpdateEditArea(oldRect, imageArea);
                 }
             };
             menu.Items.Add(verticalMirror);
@@ -1017,12 +1021,77 @@ namespace ComPDFKit.Controls.PDFControl
                     PdfViewControl.PDFViewTool.SetCropMode(!PdfViewControl.PDFViewTool.GetIsCropMode());
                 }
             };
+
             menu.Items.Add(cropMenu);
+        }
+
+        private void CreatePathEditMenu(object sender, ref ContextMenu menu)
+        {
+            int index = -1;
+            CPDFEditPathArea pathArea = PdfViewControl.PDFToolManager.GetSelectedEditAreaObject(ref index) as CPDFEditPathArea;
+            if (pathArea == null)
+                return;
 
             menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
             menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
             menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
             menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+
+            MenuItem rotateLeftMenu = new MenuItem();
+            rotateLeftMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateLeft");
+            rotateLeftMenu.Click += (o, p) =>
+            {
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(pathArea.GetFrame());
+                pathArea.Rotate(-90);
+                UpdateEditArea(oldRect, pathArea);
+            };
+            menu.Items.Add(rotateLeftMenu);
+
+            MenuItem rotateRightMenu = new MenuItem();
+            rotateRightMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateRight");
+            rotateRightMenu.Click += (o, p) =>
+            {
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(pathArea.GetFrame());
+                pathArea.Rotate(90);
+                UpdateEditArea(oldRect, pathArea);
+            };
+            menu.Items.Add(rotateRightMenu);
+
+            MenuItem opacityMenu = new MenuItem();
+            opacityMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Opacity");
+            menu.Items.Add(opacityMenu);
+            AppendOpacityMenu(opacityMenu, pathArea, CPDFEditType.EditPath);
+
+            MenuItem horizonMirror = new MenuItem();
+            horizonMirror.Header = LanguageHelper.CommonManager.GetString("Menu_HFlip");
+            horizonMirror.Click += (o, p) =>
+            {
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(pathArea.GetFrame());
+                pathArea.HorizontalMirror();
+                UpdateEditArea(oldRect, pathArea);
+            };
+            menu.Items.Add(horizonMirror);
+
+            MenuItem verticalMirror = new MenuItem();
+            verticalMirror.Header = LanguageHelper.CommonManager.GetString("Menu_VFlip");
+            verticalMirror.Click += (o, p) =>
+            {
+                Rect oldRect = DataConversionForWPF.CRectConversionForRect(pathArea.GetFrame());
+                pathArea.VerticalMirror();
+                UpdateEditArea(oldRect, pathArea);
+            };
+            menu.Items.Add(verticalMirror);
+
+            MenuItem cropMenu = new MenuItem();
+            cropMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Crop");
+            cropMenu.Click += (o, p) =>
+            {
+                if (pathArea != null)
+                {
+                    PdfViewControl.PDFViewTool.SetCropMode(!PdfViewControl.PDFViewTool.GetIsCropMode());
+                }
+            };
+            menu.Items.Add(cropMenu);
         }
 
         private void CreateMultiTextEditMenu(object sender, ref ContextMenu menu)

+ 1 - 0
Demo/Examples/Compdfkit.Controls/PageEdit/PDFPageEdit/CPDFPageEditControl.xaml.cs

@@ -1219,6 +1219,7 @@ namespace ComPDFKit.Controls.PDFControl
                 item.VerticalContentAlignment = VerticalAlignment.Center;
                 bindPageList.Add(item);
             }
+
             PageEditListBox.ItemsSource = bindPageList;
         }