|
@@ -76,6 +76,11 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
{
|
|
|
if (textAnnot != null && textAnnot.IsValid())
|
|
|
{
|
|
|
+ FreeTextAnnotHistory history = new FreeTextAnnotHistory();
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+
|
|
|
switch(CPDFFontControl.TextAlignment)
|
|
|
{
|
|
|
case TextAlignment.Left:
|
|
@@ -95,6 +100,9 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
{
|
|
|
viewControl.UpdateAnnotFrame();
|
|
|
}
|
|
|
+
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
|
}
|
|
|
}
|
|
|
CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
|
|
@@ -110,15 +118,24 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
{
|
|
|
if (textAnnot != null && textAnnot.IsValid())
|
|
|
{
|
|
|
+ FreeTextAnnotHistory history = new FreeTextAnnotHistory();
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+
|
|
|
CTextAttribute textAttr = textAnnot.FreeTextDa;
|
|
|
- string postScriptName = string.Empty;
|
|
|
- textAttr.FontName = CPDFFontControl.PostScriptName;
|
|
|
+ string psName=String.Empty;
|
|
|
+ CPDFFont.GetPostScriptName(CPDFFontControl.FontFamilyValue, CPDFFontControl.FontStyleValue, ref psName);
|
|
|
+ textAttr.FontName = psName;
|
|
|
textAnnot.SetFreetextDa(textAttr);
|
|
|
textAnnot.UpdateAp();
|
|
|
if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
viewControl.UpdateAnnotFrame();
|
|
|
}
|
|
|
+
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
|
}
|
|
|
}
|
|
|
CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
|
|
@@ -132,17 +149,26 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ FreeTextAnnotHistory history = new FreeTextAnnotHistory();
|
|
|
+ history.PDFDoc = viewControl.GetCPDFViewer().GetDocument();
|
|
|
+ history.Action = HistoryAction.Update;
|
|
|
+ history.PreviousParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+
|
|
|
CTextAttribute textAttr = textAnnot.FreeTextDa;
|
|
|
bool isBold = IsBold(textAttr.FontName);
|
|
|
bool isItalic = IsItalic(textAttr.FontName);
|
|
|
- FontType fontType = GetFontType(CPDFFontControl.FontFamilyValue);
|
|
|
- textAttr.FontName = ObtainFontName(fontType, isBold, isItalic);
|
|
|
+ string psName=String.Empty;
|
|
|
+ CPDFFont.GetPostScriptName(CPDFFontControl.FontFamilyValue, CPDFFontControl.FontStyleValue, ref psName);
|
|
|
+ textAttr.FontName = psName;
|
|
|
textAnnot.SetFreetextDa(textAttr);
|
|
|
textAnnot.UpdateAp();
|
|
|
if (viewControl != null && viewControl.PDFViewTool != null)
|
|
|
{
|
|
|
viewControl.UpdateAnnotFrame() ;
|
|
|
}
|
|
|
+
|
|
|
+ history.CurrentParam = ParamConverter.CPDFDataConverterToAnnotParam(history.PDFDoc, textAnnot.Page.PageIndex, textAnnot);
|
|
|
+ viewControl.GetCPDFViewer().UndoManager.AddHistory(history);
|
|
|
}
|
|
|
CPDFAnnotationPreviewerControl.DrawFreeTextPreview(GetFreeTextData());
|
|
|
}
|
|
@@ -181,14 +207,18 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
else
|
|
|
{
|
|
|
Color fontColor = ((SolidColorBrush)ColorPickerControl.Brush).Color;
|
|
|
- CTextAttribute textAttr = textAnnot.FreeTextDa;
|
|
|
- textAttr.FontColor = new byte[3]
|
|
|
+ CTextAttribute textAttr = new CTextAttribute
|
|
|
{
|
|
|
- fontColor.R,
|
|
|
- fontColor.G,
|
|
|
- fontColor.B,
|
|
|
+ FontName = textAnnot.FreeTextDa.FontName,
|
|
|
+ FontSize = textAnnot.FreeTextDa.FontSize,
|
|
|
+ FontColor = new byte[3]
|
|
|
+ {
|
|
|
+ fontColor.R,
|
|
|
+ fontColor.G,
|
|
|
+ fontColor.B,
|
|
|
+ }
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
if (viewControl != null && !textAnnot.FreeTextDa.FontColor.SequenceEqual(textAttr.FontColor))
|
|
|
{
|
|
|
FreeTextAnnotHistory history = new FreeTextAnnotHistory();
|