Prechádzať zdrojové kódy

ComPDFKit(win) - 注释回复完善

weixiangjie 6 mesiacov pred
rodič
commit
45fcb88759

+ 42 - 2
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs

@@ -46,14 +46,52 @@ namespace Compdfkit_Tools.PDFControl
         {
             AnnotationList.DeleteItemHandler -= AnnotationList_DeleteItemHandler;
             AnnotationList.DeleteItemHandler += AnnotationList_DeleteItemHandler;
+            AnnotationList.ReplyStatusChanged -= AnnotationList_ReplyStatusChanged;
+            AnnotationList.ReplyStatusChanged += AnnotationList_ReplyStatusChanged;
             AnnotationReplyListControl.ReplyListChanged -= ReplyListControl_ReplyListChanged;
             AnnotationReplyListControl.ReplyListChanged += ReplyListControl_ReplyListChanged;
         }
 
+        private void AnnotationList_ReplyStatusChanged(object sender, CPDFAnnotationState e)
+        {
+            if(sender is ReplyStatusControl replyStatusControl)
+            {
+                if(replyStatusControl.DataContext is AnnotationBindData data)
+                {
+                    if (pdfViewer != null)
+                    {
+                        CPDFAnnotation annot = data.BindProperty.Annotation;
+                        if (annot != null)
+                        {
+                            annot.SetState(e);
+                            pdfViewer.PDFViewTool.GetCPDFViewer().UpdateAnnotFrame();
+                            pdfViewer.PDFViewTool.IsDocumentModified = true;
+                        }
+                    }
+                }
+            }
+            else if(sender is CheckBox checkBox)
+            {
+                if(checkBox.DataContext is AnnotationBindData data)
+                {
+                    if (pdfViewer != null)
+                    {
+                        CPDFAnnotation annot = data.BindProperty.Annotation;
+                        if (annot != null)
+                        {
+                            annot.SetMarkedAnnotState(checkBox.IsChecked == true ? CPDFAnnotationState.C_ANNOTATION_MARKED : CPDFAnnotationState.C_ANNOTATION_UNMARKED,"");
+                            pdfViewer.PDFViewTool.GetCPDFViewer().UpdateAnnotFrame();
+                            pdfViewer.PDFViewTool.IsDocumentModified = true;
+                        }
+                    }
+                }
+            }
+        }
+
         private void ReplyListControl_ReplyListChanged(object sender, EventArgs e)
         {
-            LoadAnnotationList();
             pdfViewer.PDFViewTool.IsDocumentModified = true;
+            pdfViewer.PDFViewTool.GetCPDFViewer().UpdateAnnotFrame();
         }
 
         private void AnnotationList_DeleteItemHandler(object sender, Dictionary<int, List<int>> e)
@@ -127,7 +165,9 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 PageIndex = i,
                                 annotationData = annot,
-                                Annotation = annotCore
+                                pdfViewer = pdfViewer,
+                                ReplyState = annotCore.GetState(),
+                                IsMarkState = annotCore.IsMarkedStateAnnot()
                             };
                             
                             List<CPDFAnnotation> replyAnnotations = annotCore?.GetReplies();

+ 6 - 5
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/AnnotationReplyListControl.xaml

@@ -19,9 +19,9 @@
     </UserControl.Resources>
     <Grid x:Name="ReplyGrid" Margin="5">
         <Grid.RowDefinitions>
-            <RowDefinition Height="Auto"></RowDefinition>
-            <RowDefinition Height="Auto"></RowDefinition>
-            <RowDefinition Height="Auto"></RowDefinition>
+            <RowDefinition Height="0"></RowDefinition>
+            <RowDefinition Height="0"></RowDefinition>
+            <RowDefinition Height="0"></RowDefinition>
         </Grid.RowDefinitions>
         
         <Grid Grid.Row="0">
@@ -31,11 +31,12 @@
         </Grid>
         
         <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,0">
-            <Button Content="Cancel" Background="Transparent" BorderThickness="0" Margin="0,0,5,0" Width="56" Height="30"></Button>
+            <Button Content="Cancel" Background="Transparent" BorderThickness="0" Margin="0,0,5,0" Width="56" Height="30" Click="ButtonCancel_Click"></Button>
             <Button Content="Reply" Width="56" Height="30" Foreground="White" Background="#1460F3" BorderThickness="0" Click="ReplyButton_Click"></Button>
         </StackPanel>
         
-        <ListView Grid.Row="2" x:Name="ReplyList" Margin="0,5,0,0">
+        <ListView Grid.Row="2" x:Name="ReplyList" Margin="0,5,0,0" VirtualizingPanel.IsVirtualizingWhenGrouping="True" 
+                  ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single" >
             <ListView.ItemsPanel>
                 <ItemsPanelTemplate>
                     <VirtualizingStackPanel Background="#FAFCFF" HorizontalAlignment="Stretch" MaxHeight="200"

+ 64 - 1
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/AnnotationReplyListControl.xaml.cs

@@ -16,6 +16,9 @@ namespace Compdfkit_Tools.PDFControlUI
 {
     public partial class AnnotationReplyListControl : UserControl
     {
+        /// <summary>
+        /// The source of the reply list.
+        /// </summary>
         public static readonly DependencyProperty ReplyListProperty = DependencyProperty.Register(
             nameof(ReplyListSource),
             typeof(ObservableCollection<CPDFAnnotationListUI.ReplyData>),
@@ -37,17 +40,71 @@ namespace Compdfkit_Tools.PDFControlUI
             }
         }
         
+        /// <summary>
+        /// The visibility of the reply input.
+        /// </summary>
+        public static readonly DependencyProperty IsShowInputProperty = DependencyProperty.Register(
+            nameof(IsShowInput),
+            typeof(bool),
+            typeof(AnnotationReplyListControl),
+            new PropertyMetadata(false, OnIsShowInputChanged));
+        
+        public bool IsShowInput 
+        {
+            get => (bool)GetValue(IsShowInputProperty);
+            set => SetValue(IsShowInputProperty, value);
+        }
+        
+        private static void OnIsShowInputChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            if (d is AnnotationReplyListControl control)
+            {
+                control.SetReplyInputVisibility((bool)e.NewValue);
+            }
+        }
+        
+        /// <summary>
+        /// The visibility of the reply list.
+        /// </summary>
+        public static readonly DependencyProperty IsShowListProperty = DependencyProperty.Register(
+            nameof(IsShowList),
+            typeof(bool),
+            typeof(AnnotationReplyListControl),
+            new PropertyMetadata(false, OnIsShowListChanged));
+        
+        public bool IsShowList 
+        {
+            get => (bool)GetValue(IsShowListProperty);
+            set => SetValue(IsShowListProperty, value);
+        }
+        
+        private static void OnIsShowListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            if (d is AnnotationReplyListControl control)
+            {
+                control.SetReplyListVisibility((bool)e.NewValue);
+            }
+        }
+        
         public static event EventHandler ReplyListChanged;
+        public static event EventHandler<CPDFAnnotationListUI.ReplyData> ReplyDeleted;
         
         public static void InvokeReplyListChanged()
         {
             ReplyListChanged?.Invoke(null, EventArgs.Empty);
         }
         
+        public static void InvokeReplyDeleted(CPDFAnnotationListUI.ReplyData replyData)
+        {
+            ReplyDeleted?.Invoke(null, replyData);
+        }
+        
         public AnnotationReplyListControl()
         {
             InitializeComponent();
             ReplyList.ItemsSource = ReplyListSource;
+            ReplyListChanged += (sender, args) => ReplyList.Items.Refresh();
+            ReplyDeleted += (sender, replyData) => ReplyListSource.Remove(replyData);
         }
         
         public void SetReplyInputVisibility(bool isVisible)
@@ -91,7 +148,7 @@ namespace Compdfkit_Tools.PDFControlUI
                     {
                         var replyAnnot = annotBindData.BindProperty.Annotation.CreateReplyAnnotation();
                         replyAnnot.SetContent(InputTxb.Text);
-                        replyAnnot.SetAuthor(Helper.CommonHelper.Author);
+                        replyAnnot.SetAuthor(Data.CPDFAnnotationData.Author);
                         annotBindData.BindProperty.ReplyList.Add(new CPDFAnnotationListUI.ReplyData
                         {
                             ReplyAnnotation = replyAnnot
@@ -102,6 +159,11 @@ namespace Compdfkit_Tools.PDFControlUI
                 }
             }
         }
+
+        private void ButtonCancel_Click(object sender, RoutedEventArgs e)
+        {
+            IsShowInput = false;
+        }
     }
     
     public class ShowContentBoxCommand : ICommand
@@ -139,6 +201,7 @@ namespace Compdfkit_Tools.PDFControlUI
             {
                 replyData.ReplyAnnotation.RemoveAnnot();
                 AnnotationReplyListControl.InvokeReplyListChanged();
+                AnnotationReplyListControl.InvokeReplyDeleted(replyData);
             }
         }
     }

+ 20 - 6
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnotationListUI.xaml

@@ -143,7 +143,8 @@
                                     <TextBlock Text="{Binding BindProperty.Author}"></TextBlock>
                                     <TextBlock Text="{Binding BindProperty.CreateDate}" ></TextBlock>
                                 </StackPanel>
-                                <CheckBox Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
+                                <CheckBox Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding BindProperty.IsMarkState}" 
+                                          Checked="ToggleButton_Checked" Unchecked="ToggleButton_Unchecked">
                                     <CheckBox.Style>
                                         <Style TargetType="CheckBox">
                                             <Style.Triggers>
@@ -157,26 +158,39 @@
                                         </Style>
                                     </CheckBox.Style>
                                 </CheckBox>
-                            </Grid>
+                            </Grid> 
                         </Grid>
                         <TextBox Text="{Binding BindProperty.Note, Mode=OneWay}"  Grid.Row="1" TextWrapping="Wrap" AcceptsReturn="True" IsHitTestVisible="False" Background="Transparent" BorderThickness="0" Width="{Binding ElementName=AnnotationList,Path=ActualWidth}" Padding="16,6,16,6" FontFamily="Microsoft YaHei" FontSize="14px"></TextBox>
-                        <pdfControlUi:AnnotationReplyListControl x:Name="ReplyListControl" Grid.Row="2" ReplyListSource="{Binding BindProperty.ReplyList}"></pdfControlUi:AnnotationReplyListControl>
+                        <pdfControlUi:AnnotationReplyListControl x:Name="ReplyListControl" Grid.Row="2" ReplyListSource="{Binding BindProperty.ReplyList}"
+                                                                 IsShowList="{Binding IsReplyListVisible}" IsShowInput="{Binding IsReplyInputVisible,Mode=TwoWay}"></pdfControlUi:AnnotationReplyListControl>
                         <Grid Grid.Row="3">
                             <Grid.ColumnDefinitions>
                                 <ColumnDefinition Width="50"></ColumnDefinition>
                                 <ColumnDefinition Width="*"></ColumnDefinition>
                             </Grid.ColumnDefinitions>
-                            <pdfControlUi:ReplyStatusControl Grid.Column="0"></pdfControlUi:ReplyStatusControl>
+                            <pdfControlUi:ReplyStatusControl x:Name="StatusControl" Status="{Binding BindProperty.ReplyState}" ReplyStatusChanged="StatusControl_ReplyStatusChanged" Grid.Column="0"></pdfControlUi:ReplyStatusControl>
                             <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
-                                <Button Width="40" Height="20" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.CallReplyListMethodCommand, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}">
+                                <Button Width="40" Height="20" Background="Transparent" BorderThickness="0">
+                                    <Button.Command>
+                                        <pdfControlUi:ShowReplyListCommand/>
+                                    </Button.Command>
+                                    <Button.CommandParameter>
+                                        <Binding Path="."></Binding>
+                                    </Button.CommandParameter>
                                     <StackPanel Orientation="Horizontal">
                                         <Path Data="M16 12.3333C16 12.7017 15.8537 13.055 15.5932 13.3154C15.3327 13.5759 14.9795 13.7222 14.6111 13.7222H6.27778L3.5 16.5V5.38889C3.5 5.02053 3.64633 4.66726 3.9068 4.4068C4.16726 4.14633 4.52053 4 4.88889 4H14.6111C14.9795 4 15.3327 4.14633 15.5932 4.4068C15.8537 4.66726 16 5.02053 16 5.38889V12.3333Z" 
                                               Stroke="#43474D" StrokeThickness="1.25" StrokeEndLineCap="Round" StrokeLineJoin="Round"/>
-                                        <TextBlock Text="4"  VerticalAlignment="Bottom" Margin="5,0,0,0"/>
+                                        <TextBlock Text="{Binding BindProperty.ReplyCount}"  VerticalAlignment="Bottom" Margin="5,0,0,0"/>
                                     </StackPanel>
                                 </Button>
 
                                 <Button Width="20" Height="20" Background="Transparent" BorderThickness="0" Margin="10,0,10,0">
+                                    <Button.Command>
+                                        <pdfControlUi:ShowReplyInputCommand/>
+                                    </Button.Command>
+                                    <Button.CommandParameter>
+                                        <Binding Path="."></Binding>
+                                    </Button.CommandParameter>
                                     <Canvas Width="20" Height="20">
                                         <Path Data="M7.95833 8.75L4 12.7083L7.95833 16.6667" 
                                               Stroke="#43474D" StrokeThickness="1.5" StrokeEndLineCap="Round" StrokeLineJoin="Round"/>

+ 156 - 3
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnotationListUI.xaml.cs

@@ -10,10 +10,49 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Data;
 using System.Windows.Input;
+using System.Windows.Media.Animation;
 using Compdfkit_Tools.Helper;
+using Compdfkit_Tools.PDFControl;
+using ComPDFKitViewer;
 
 namespace Compdfkit_Tools.PDFControlUI
 {
+    public class ShowReplyListCommand : ICommand
+    {
+        public event EventHandler CanExecuteChanged;
+
+        public bool CanExecute(object parameter)
+        {
+            return true;
+        }
+
+        public void Execute(object parameter)
+        {
+            if (parameter is CPDFAnnotationListUI.AnnotationBindData data)
+            {
+                data.IsReplyListVisible = !data.IsReplyListVisible;
+            }
+        }
+    }
+    
+    public class ShowReplyInputCommand : ICommand
+    {
+        public event EventHandler CanExecuteChanged;
+
+        public bool CanExecute(object parameter)
+        {
+            return true;
+        }
+
+        public void Execute(object parameter)
+        {
+            if (parameter is CPDFAnnotationListUI.AnnotationBindData data)
+            {
+                data.IsReplyInputVisible = !data.IsReplyInputVisible;
+            }
+        }
+    }
+    
     public partial class CPDFAnnotationListUI : UserControl
     {
         public class ReplyData
@@ -27,7 +66,27 @@ namespace Compdfkit_Tools.PDFControlUI
 
             public string Date
             {
-                get => ReplyAnnotation.GetCreationDate();
+                get
+                {
+                    try
+                    {
+                        if (Regex.IsMatch(ReplyAnnotation.GetCreationDate(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
+                        {
+                            string dateStr = Regex.Match(ReplyAnnotation.GetCreationDate(), "(?<=D\\:)[0-9]+(?=[\\+\\-])").Value;
+                            return (dateStr.Substring(0, 4) + "-" + dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2) + ", " + dateStr.Substring(8, 2) + ":" +
+                                    dateStr.Substring(10, 2));
+                        }
+                        else
+                        {
+                            return String.Empty;
+                        }
+                    }
+                    catch (Exception)
+                    {
+                        return String.Empty;
+                    }
+                    
+                }
                 set => ReplyAnnotation.SetCreationDate(value);
             }
 
@@ -40,7 +99,39 @@ namespace Compdfkit_Tools.PDFControlUI
         
         public class BindAnnotationResult : INotifyPropertyChanged
         {
-            public ObservableCollection<ReplyData> ReplyList { get; set; } = new ObservableCollection<ReplyData>();
+            private ObservableCollection<ReplyData> _replyList = new ObservableCollection<ReplyData>();
+
+            public ObservableCollection<ReplyData> ReplyList
+            {
+                get => _replyList;
+                set
+                {
+                    if (_replyList != value)
+                    {
+                        if (_replyList != null)
+                        {
+                            // Unsubscribe from the previous collection
+                            _replyList.CollectionChanged -= ReplyList_CollectionChanged;
+                        }
+
+                        _replyList = value;
+
+                        if (_replyList != null)
+                        {
+                            // Subscribe to the new collection
+                            _replyList.CollectionChanged += ReplyList_CollectionChanged;
+                        }
+
+                        OnPropertyChanged(nameof(ReplyList));
+                    }
+                }
+            }
+            
+            private void ReplyList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+            {
+                // Notify that the ReplyCount has changed when the collection changes
+                OnPropertyChanged(nameof(ReplyCount));
+            }
             
             public int PageIndex { get; set; }
 
@@ -51,6 +142,11 @@ namespace Compdfkit_Tools.PDFControlUI
                 get => annotationData.Author;
             }
             
+            public string ReplyCount
+            {
+                get => ReplyList.Count.ToString();
+            }
+            
             public string CreateDate
             {
                 get
@@ -79,8 +175,26 @@ namespace Compdfkit_Tools.PDFControlUI
             }
 
             public AnnotParam annotationData { get; set; }
+
+            private CPDFAnnotation _annotation;
+            public CPDFAnnotation Annotation
+            {
+                get
+                {
+                    CPDFAnnotation annotCore = pdfViewer?.GetCPDFViewer()?.GetAnnotForIndex(annotationData.PageIndex, annotationData.AnnotIndex)?.GetAnnotData()?.Annot;
+                    return annotCore;
+                }
+            }
+            public PDFViewControl pdfViewer{get;set;}
+
+
+            public CPDFAnnotationState ReplyState { get; set; }
             
-            public CPDFAnnotation Annotation { get; set; }
+            public bool IsMarkState { get; set; }
+            public BindAnnotationResult()
+            {
+                ReplyList.CollectionChanged += ReplyList_CollectionChanged;
+            }
 
             public event PropertyChangedEventHandler PropertyChanged;
             protected void OnPropertyChanged(string propertyName)
@@ -105,6 +219,28 @@ namespace Compdfkit_Tools.PDFControlUI
                     }
                 }
             }
+            
+            private bool _isReplyListVisible;
+            public bool IsReplyListVisible
+            {
+                get { return _isReplyListVisible; }
+                set
+                {
+                    _isReplyListVisible = value;
+                    OnPropertyChanged(nameof(IsReplyListVisible));
+                }
+            }
+            
+            private bool _isReplyInputVisible;
+            public bool IsReplyInputVisible
+            {
+                get { return _isReplyInputVisible; }
+                set
+                {
+                    _isReplyInputVisible = value;
+                    OnPropertyChanged(nameof(IsReplyInputVisible));
+                }
+            }
 
             public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
 
@@ -121,6 +257,8 @@ namespace Compdfkit_Tools.PDFControlUI
         public event EventHandler<object> AnnotationSelectionChanged;
 
         public event EventHandler<Dictionary<int, List<int>>> DeleteItemHandler;
+        
+        public event EventHandler<CPDFAnnotationState> ReplyStatusChanged;
 
         private ContextMenu popContextMenu;
         private bool enableSelectEvent = true;
@@ -287,6 +425,21 @@ namespace Compdfkit_Tools.PDFControlUI
         {
             CancelSelected();
         }
+
+        private void StatusControl_ReplyStatusChanged(object sender, CPDFAnnotationState e)
+        { 
+            ReplyStatusChanged?.Invoke(sender, e);
+        }
+
+        private void ToggleButton_Checked(object sender, RoutedEventArgs e)
+        {
+            ReplyStatusChanged?.Invoke(sender, CPDFAnnotationState.C_ANNOTATION_MARKED);
+        }
+
+        private void ToggleButton_Unchecked(object sender, RoutedEventArgs e)
+        {
+            ReplyStatusChanged?.Invoke(sender, CPDFAnnotationState.C_ANNOTATION_UNMARKED);
+        }
     }
     
     public class SubtractionConverter : IValueConverter

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 40 - 16
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/ReplyStatusControl.xaml.cs


+ 0 - 1
Demo/Examples/Compdfkit_Tools/Common/Helper/CommonHelper.cs

@@ -59,7 +59,6 @@ namespace Compdfkit_Tools.Helper
 
     public static class CommonHelper
     {
-        public static string Author { set; get; }
         public static bool IsImageCorrupted(string imagePath)
         {
             try

+ 0 - 1
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -200,7 +200,6 @@ namespace PDFViewer
                 pdfviewer.SetLinkHighlight(Properties.Settings.Default.IsHighlightLinkArea);
                 pdfviewer.SetFormFieldHighlight(Properties.Settings.Default.IsHighlightFormArea);
                 pdfviewer.ScrollStride = Properties.Settings.Default.Divisor;
-                Compdfkit_Tools.Helper.CommonHelper.Author = Properties.Settings.Default.DocumentAuthor;
             }
         }
 

+ 12 - 0
Demo/Examples/PDFViewer/Properties/Settings.Designer.cs

@@ -59,6 +59,18 @@ namespace PDFViewer.Properties {
             }
         }
         
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("Guest")]
+        public string AnnotationAuthor {
+            get {
+                return ((string)(this["AnnotationAuthor"]));
+            }
+            set {
+                this["AnnotationAuthor"] = value;
+            }
+        }
+        
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         [global::System.Configuration.DefaultSettingValueAttribute("")]

+ 7 - 2
Demo/Examples/PDFViewer/SettingsDialog.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:PDFViewer"
         xmlns:common="clr-namespace:Compdfkit_Tools.Common;assembly=ComPDFKit_Tools"
         mc:Ignorable="d"
-        Title="Settings" Height="580" Width="440"
+        Title="Settings" Height="680" Width="440"
         ShowInTaskbar="False"
         WindowStartupLocation="CenterScreen"
         ResizeMode="NoResize"
@@ -103,7 +103,7 @@
     </Window.Resources>
     <Grid Margin="24,0,24,0">
         <Grid.RowDefinitions>
-            <RowDefinition Height="106"></RowDefinition>
+            <RowDefinition Height="166"></RowDefinition>
             <RowDefinition Height="150"></RowDefinition>
             <RowDefinition Height="35"></RowDefinition>
             <RowDefinition Height="45"/>
@@ -116,6 +116,11 @@
                 <TextBox x:Name="AuthorTxb" Padding="5,0,5,0" TextChanged="AuthorTxb_TextChanged"  HorizontalAlignment="Right" VerticalContentAlignment="Center" Width="130">
                 </TextBox>
             </Grid>
+            <Grid Margin="0,0,0,8" Height="32">
+                <TextBlock Text="{Binding  ConverterParameter=Setting_Author, Converter={StaticResource ResourceConverter}}" FontSize="14" FontWeight="DemiBold" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
+                <TextBox x:Name="AnnotatorTxb" Padding="5,0,5,0" TextChanged="AnnotatorTxb_TextChanged"  HorizontalAlignment="Right" VerticalContentAlignment="Center" Width="130">
+                </TextBox>
+            </Grid>
             <Grid Height="32">
                 <TextBlock Text="{Binding  ConverterParameter=Setting_Language, Converter={StaticResource ResourceConverter}}" FontSize="14" FontWeight="DemiBold" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                 <ComboBox x:Name="LanguageCmb" SelectionChanged="LanguageCmb_SelectionChanged" Style="{StaticResource ComboBoxStyle1}" HorizontalAlignment="Right" Width="130">

+ 7 - 1
Demo/Examples/PDFViewer/SettingsDialog.xaml.cs

@@ -32,7 +32,7 @@ namespace PDFViewer
         {
             Properties.Settings.Default.Divisor = GetDivisor();
             Properties.Settings.Default.Save();
-            Compdfkit_Tools.Data.CPDFAnnotationData.Author = Properties.Settings.Default.DocumentAuthor;
+            Compdfkit_Tools.Data.CPDFAnnotationData.Author = Properties.Settings.Default.AnnotationAuthor;
         }
 
         private void EventSetter_ClickHandler(object sender, RoutedEventArgs e)
@@ -58,6 +58,7 @@ namespace PDFViewer
             HighlightFormTog.IsChecked = Properties.Settings.Default.IsHighlightFormArea;
             HighlightLinkTog.IsChecked = Properties.Settings.Default.IsHighlightLinkArea;
             AuthorTxb.Text = Properties.Settings.Default.DocumentAuthor;
+            AnnotatorTxb.Text = Properties.Settings.Default.AnnotationAuthor;
             SelectCurrentLanguage();
             DivisorTxb.Text = Properties.Settings.Default.Divisor.ToString();
         }
@@ -77,6 +78,11 @@ namespace PDFViewer
         {
             Properties.Settings.Default.DocumentAuthor = AuthorTxb.Text;
         }
+        
+        private void AnnotatorTxb_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            Properties.Settings.Default.AnnotationAuthor = AnnotatorTxb.Text;
+        }
 
         private void HighlightLinkTog_Click(object sender, RoutedEventArgs e)
         {

+ 9 - 0
Demo/Examples/PDFViewer/Strings/SettingDialog.Designer.cs

@@ -86,6 +86,15 @@ namespace PDFViewer.Strings.SettingDialog {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Annotator.
+        /// </summary>
+        internal static string Setting_Annotator {
+            get {
+                return ResourceManager.GetString("Setting_Annotator", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to File Author.
         /// </summary>

+ 3 - 0
Demo/Examples/PDFViewer/Strings/SettingDialog.resx

@@ -78,4 +78,7 @@
     <data name="Setting_Divisor" xml:space="preserve">
         <value>Rolling Ratio</value>
     </data>
+    <data name="Setting_Annotator" xml:space="preserve">
+        <value>Annotator</value>
+    </data>
 </root>

+ 3 - 0
Demo/Examples/PDFViewer/Strings/SettingDialog.zh.resx

@@ -71,4 +71,7 @@
     <data name="Setting_Divisor" xml:space="preserve">
         <value>滚动比例</value>
     </data>
+    <data name="Setting_Annotator" xml:space="preserve">
+        <value>注释作者</value>
+    </data>
 </root>