|
@@ -9,6 +9,8 @@ using ComPDFKit.PDFPage.Edit;
|
|
|
using ComPDFKit.Tool.SettingParam;
|
|
|
using ComPDFKit.Tool.UndoManger;
|
|
|
using ComPDFKit.Viewer.Helper;
|
|
|
+using ComPDFKitViewer.Helper;
|
|
|
+using ComPDFKitViewer;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
@@ -169,12 +171,39 @@ namespace ComPDFKit.Tool.Help
|
|
|
return annotHistory;
|
|
|
}
|
|
|
|
|
|
- public static bool RemovePageAnnot(Dictionary<int, List<int>> removeAnnots, CPDFDocument cPDFDocument)
|
|
|
+ public static bool RemovePageAnnot(Dictionary<int, List<int>> removeAnnots, CPDFViewer cPDFViewer)
|
|
|
{
|
|
|
+ CPDFDocument cPDFDocument = cPDFViewer.GetDocument();
|
|
|
if (cPDFDocument == null || removeAnnots.Count <= 0)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ GroupHistory historyGroup = new GroupHistory();
|
|
|
+ foreach (int pageIndex in removeAnnots.Keys)
|
|
|
+ {
|
|
|
+ CPDFPage pageCore = cPDFDocument.PageAtIndex(pageIndex);
|
|
|
+ List<CPDFAnnotation> cPDFAnnotations = pageCore.GetAnnotations();
|
|
|
+ foreach (int annotIndex in removeAnnots[pageIndex])
|
|
|
+ {
|
|
|
+ CPDFAnnotation cPDFAnnotation = cPDFAnnotations.ElementAtOrDefault(annotIndex);
|
|
|
+ if (cPDFAnnotation != null)
|
|
|
+ {
|
|
|
+ AnnotParam annotParam = CPDFDataConverterToAnnotParam(cPDFDocument, pageIndex, cPDFAnnotation);
|
|
|
+ AnnotHistory annotHistory = CreateHistory(cPDFAnnotation);
|
|
|
+ annotHistory.CurrentParam = annotParam;
|
|
|
+ annotHistory.PDFDoc = cPDFDocument;
|
|
|
+ annotHistory.Action = HistoryAction.Remove;
|
|
|
+ historyGroup.Histories.Add(annotHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (historyGroup.Histories.Count > 0)
|
|
|
+ {
|
|
|
+ cPDFViewer.UndoManager.AddHistory(historyGroup);
|
|
|
+ }
|
|
|
+
|
|
|
foreach (int pageIndex in removeAnnots.Keys)
|
|
|
{
|
|
|
CPDFPage pageCore = cPDFDocument.PageAtIndex(pageIndex);
|
|
@@ -188,7 +217,8 @@ namespace ComPDFKit.Tool.Help
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return false;
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public static FormField ConverterWidgetFormFlags(int Flags, bool IsHidden)
|