Преглед изворни кода

Merge branch 'compdfkit_demo_win_rebuild' of http://git.kdan.cc:8865/Others/kmpdfkit_demo into compdfkit_demo_win_rebuild

zhuyi пре 8 месеци
родитељ
комит
9b83d60139
55 измењених фајлова са 870 додато и 2200 уклоњено
  1. 10 2
      Demo/Examples/Annotations/MainWindow.xaml.cs
  2. 0 161
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml
  3. 0 636
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml.cs
  4. 1 343
      Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs
  5. 1 0
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs
  6. 1 4
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnoationListUI.xaml.cs
  7. 17 60
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs
  8. 12 20
      Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs
  9. 1 8
      Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs
  10. 70 28
      Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml.cs
  11. 375 734
      Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs
  12. 93 97
      Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs
  13. 4 0
      Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageUI/CPDFImageFlipUI.xaml.cs
  14. 7 0
      Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageUI/CPDFImageRotateUI.xaml.cs
  15. 19 1
      Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml.cs
  16. 11 2
      Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextAlignUI.xaml.cs
  17. 11 0
      Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml.cs
  18. 5 0
      Demo/Examples/Compdfkit_Tools/Measure/MeasureControl.xaml.cs
  19. 2 11
      Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs
  20. 8 0
      Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs
  21. 1 2
      Demo/Examples/Compdfkit_Tools/Watermark/AddWatermark/WatermarkDialog.xaml.cs
  22. 15 3
      Demo/Examples/DigitalSignature/DigitalSignature.csproj
  23. 1 1
      Demo/Examples/PDFViewer/App.xaml.cs
  24. 16 29
      Demo/Examples/PDFViewer/MainPage.xaml.cs
  25. 2 0
      Demo/Examples/Samples/AnnotationImportExportTest/CS/AnnotationImportExportTest.csproj
  26. 38 0
      Demo/Examples/Samples/AnnotationImportExportTest/CS/Properties/AssemblyInfo.cs
  27. 2 3
      Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.cs
  28. 3 2
      Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.csproj
  29. 1 3
      Demo/Examples/Samples/AnnotationTest/CS/Properties/AssemblyInfo.cs
  30. 3 2
      Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.csproj
  31. 2 4
      Demo/Examples/Samples/BackgroundTest/CS/Properties/AssemblyInfo.cs
  32. 3 1
      Demo/Examples/Samples/BatesTest/CS/BatesTest.csproj
  33. 3 1
      Demo/Examples/Samples/BookmarkTest/CS/BookmarkTest.csproj
  34. 20 11
      Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.cs
  35. 17 1
      Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.csproj
  36. 2 1
      Demo/Examples/Samples/DocumentCompareTest/CS/DocumentCompareTest.csproj
  37. 3 1
      Demo/Examples/Samples/DocumentInfoTest/CS/DocumentInfoTest.csproj
  38. 3 1
      Demo/Examples/Samples/EncryptTest/CS/EncryptTest.csproj
  39. 3 1
      Demo/Examples/Samples/FlattenTest/CS/FlattenTest.csproj
  40. 3 1
      Demo/Examples/Samples/HeaderFooterTest/CS/HeaderFooterTest.csproj
  41. 3 1
      Demo/Examples/Samples/ImageExtractTest/CS/ImageExtractTest.csproj
  42. 3 1
      Demo/Examples/Samples/InteractiveFormsTest/CS/InteractiveFormsTest.csproj
  43. 3 1
      Demo/Examples/Samples/OutlineTest/CS/OutlineTest.csproj
  44. 3 1
      Demo/Examples/Samples/PDFATest/CS/PDFATest.csproj
  45. 3 1
      Demo/Examples/Samples/PDFPageTest/CS/PDFPageTest.csproj
  46. 1 3
      Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.cs
  47. 3 1
      Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.csproj
  48. 12 2
      Demo/Examples/Samples/PDFToImage/CS/PDFToImageTest.csproj
  49. 36 0
      Demo/Examples/Samples/PDFToImage/CS/Properties/AssemblyInfo.cs
  50. 2 1
      Demo/Examples/Samples/PDFToImageTest/CS/PDFToImageTest.csproj
  51. 3 1
      Demo/Examples/Samples/TextExtractTest/CS/TextExtractTest.csproj
  52. 1 4
      Demo/Examples/Samples/TextSearchTest/CS/Properties/AssemblyInfo.cs
  53. 3 1
      Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.csproj
  54. 2 5
      Demo/Examples/Samples/WatermarkTest/CS/Properties/AssemblyInfo.cs
  55. 3 2
      Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.csproj

+ 10 - 2
Demo/Examples/Annotations/MainWindow.xaml.cs

@@ -22,6 +22,7 @@ using Compdfkit_Tools.PDFView;
 using ComPDFKit.Tool;
 using System.Reflection;
 using System.Linq;
+using Compdfkit_Tools.PDFControlUI;
 
 namespace AnnotationViewControl
 {
@@ -147,7 +148,7 @@ namespace AnnotationViewControl
                 //annotationControl.PDFViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
                 CPDFSaclingControl.InitWithPDFViewer(annotationControl.PDFViewControl);
                 //CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(annotationControl.PDFViewControl.PDFView.ZoomFactor * 100)));
-
+                displaySettingsControl.InitWithPDFViewer(annotationControl.PDFViewControl);
                 ViewSettingBtn.IsChecked = false;
                 botaBarControl.InitWithPDFViewer(annotationControl.PDFViewControl);
                 botaBarControl.AddBOTAContent(new[]
@@ -159,9 +160,16 @@ namespace AnnotationViewControl
                 annotationControl.InitialPDFViewControl(annotationControl.PDFViewControl);
                 panelState.PropertyChanged -= PanelState_PropertyChanged;
                 panelState.PropertyChanged += PanelState_PropertyChanged;
+                displaySettingsControl.SplitModeChanged -= DisplaySettingsControl_SplitModeChanged;
+                displaySettingsControl.SplitModeChanged += DisplaySettingsControl_SplitModeChanged;
             }
         }
-        
+
+        private void DisplaySettingsControl_SplitModeChanged(object sender, CPDFViewModeUI.SplitMode e)
+        {
+            pdfViewer.SetSplitViewMode(e);
+        }
+
         private void OpenFile()
         {
             string filePath = CommonHelper.GetExistedPathOrEmpty();

+ 0 - 161
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml

@@ -1,161 +0,0 @@
-<UserControl x:Class="Compdfkit_Tools.PDFControl.AnnotationControl"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             mc:Ignorable="d"
-             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
-             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
-             Loaded="MainWindow_Loaded"
-             d:DesignHeight="720" d:DesignWidth="1080">
-    <UserControl.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
-                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
-                <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
-    </UserControl.Resources>
-    <Grid>
-        <Grid>
-            <Grid.RowDefinitions>
-                <RowDefinition Height="*"></RowDefinition>
-            </Grid.RowDefinitions>
-            <Grid Name="BodyGrid" Grid.Row="1">
-                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"/>
-                    <RowDefinition Height="*"/>
-                </Grid.RowDefinitions> 
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="0"></ColumnDefinition>
-                    <ColumnDefinition Width="0"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-
-                <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
-                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
-                        <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Height="44"/>
-                        <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" /> 
-                        <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
-                                    Background="Transparent">
-                            <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
-                                <Path.Style>
-                                    <Style TargetType="Path">
-                                        <Style.Triggers>
-                                            <Trigger Property="IsEnabled" Value="False">
-                                                <Setter Property="Fill" Value="LightGray"/>
-                                            </Trigger>
-                                            <Trigger Property="IsEnabled" Value="True">
-                                                <Setter Property="Fill" Value="#43474D"/>
-                                            </Trigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </Path.Style>
-                                <Path.Data>
-                                    M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
-                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
-                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
-                                </Path.Data>
-                            </Path>
-                            <Button.ToolTip>
-                                <ToolTip Content="Undo"></ToolTip>
-                            </Button.ToolTip>
-                        </Button> 
-                        <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
-                                    Background="Transparent">
-                            <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
-                                <Path.Resources>
-                                    <Style TargetType="Path">
-                                        <Style.Triggers>
-                                            <Trigger Property="IsEnabled" Value="False">
-                                                <Setter Property="Fill" Value="LightGray"/>
-                                            </Trigger>
-                                            <Trigger Property="IsEnabled" Value="True">
-                                                <Setter Property="Fill" Value="#43474D"/>
-                                            </Trigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </Path.Resources>
-                                <Path.Data>
-                                    M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
-                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
-                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
-                                </Path.Data>
-                            </Path>
-                            <Button.ToolTip>
-                                <ToolTip Content="Redo"></ToolTip>
-                            </Button.ToolTip>
-                        </Button>
-                    </StackPanel>
-                </Border>
-                   <Border Grid.Row="1" Visibility="Collapsed" Name="BotaContainer">
-                   </Border>
-                <GridSplitter  Grid.Row="1" Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
-                    <GridSplitter.Template>
-                        <ControlTemplate TargetType="{x:Type GridSplitter}">
-                            <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
-                        BorderBrush="{TemplateBinding Border.BorderBrush}"
-                        Background="{TemplateBinding Panel.Background}" >
-                                <Path Fill="Gray" VerticalAlignment="Center">
-                                    <Path.Data>
-                                        M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
-                                    </Path.Data>
-                                </Path>
-                            </Border>
-                        </ControlTemplate>
-                    </GridSplitter.Template>
-                </GridSplitter>
-
-                <Grid  Grid.Row="1" Grid.Column="2" >
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="auto"/>
-                        <RowDefinition Height="*"/>
-                    </Grid.RowDefinitions>
-                    
-                    <Grid Grid.Row="1">
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition></ColumnDefinition>
-                            <ColumnDefinition Width="auto"></ColumnDefinition>
-                        </Grid.ColumnDefinitions> 
-                        <Border x:Name="PDFGrid" Background="#CECECE"></Border> 
-                        <Border Grid.Column="1" Grid.RowSpan="2" Name="PropertyContainer" Visibility="Collapsed"></Border>
-                    </Grid>
- 
-                    <cpdfcommon:PageNumberControl Grid.Row="1" x:Name="FloatPageTool" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20"></cpdfcommon:PageNumberControl>
-                </Grid>
-            </Grid>
-        </Grid>
-
-        <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
-            <Grid> 
-                <Grid Name="FileInfoUI"  Width="422" Height="680" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" Visibility="Collapsed">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*"></ColumnDefinition>
-                        <ColumnDefinition Width="*"></ColumnDefinition>
-                    </Grid.ColumnDefinitions>
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="auto"></RowDefinition>
-                        <RowDefinition Height="*"></RowDefinition>
-                    </Grid.RowDefinitions>
-
-                    <TextBlock Width="50" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">FileInfo:</TextBlock>
-                    <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
-                        <Button.Content>
-                            <Path Fill="Black">
-                                <Path.Data>
-                                    M6.69495 6L11.5 1.19495L10.805 0.5L6 5.30505L1.19495 0.5L0.5 1.19495L5.30505 6L0.5 10.805L1.19495 11.5L6 6.69495L10.805 11.5L11.5 10.805L6.69495 6Z
-                                </Path.Data>
-                            </Path>
-                        </Button.Content>
-                    </Button>
-                    <cpdftools:CPDFInfoControl Grid.Row="1" Margin="25,10,25,0" Grid.ColumnSpan="2" x:Name="FileInfoControl"></cpdftools:CPDFInfoControl>
-                </Grid>
- 
-                <cpdfcommon:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></cpdfcommon:PasswordDialog>
-            </Grid>
-
-        </Border>
-    </Grid>
-</UserControl>

Разлика између датотеке није приказан због своје велике величине
+ 0 - 636
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl.xaml.cs


+ 1 - 343
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -164,8 +164,6 @@ namespace Compdfkit_Tools.PDFControl
 
         private void UserControl_Unloaded(object sender, RoutedEventArgs e)
         {
-            //PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
-            //PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
             PDFViewControl.MouseRightButtonDownHandler -= PDFViewControl_MouseRightButtonDownHandler;
         }
 
@@ -378,346 +376,6 @@ namespace Compdfkit_Tools.PDFControl
 
         #endregion
 
-        //#region Context menu
-
-        //private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
-        //{
-        //    switch (e.CommandType)
-        //    {
-        //        case CommandType.Context:
-        //            e.Handle = true;
-        //            if (e.CommandTarget == TargetType.Annot)
-        //            {
-        //                e.Handle = true;
-        //                e.PopupMenu = new ContextMenu();
-        //                if (e.PressOnLink && AnnotationBarControl.CurrentMode == "Link")
-        //                {
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
-        //                    MenuItem propertyMenu = new MenuItem();
-        //                    propertyMenu = new MenuItem();
-        //                    propertyMenu.Header = "Edit";
-        //                    WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(propertyMenu, "Click", EditLink_Click);
-        //                    propertyMenu.CommandParameter = e;
-        //                    e.PopupMenu.Items.Add(propertyMenu);
-        //                }
-        //                else if (e.PressOnAnnot)
-        //                {
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
-        //                }
-        //                else if (e.PressOnMedia || e.PressOnSound)
-        //                {
-        //                    e.Handle = true;
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Play", Command = MediaCommands.Play, CommandTarget = (UIElement)sender, CommandParameter = e });
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
-        //                }
-        //                else if (e.PressOnSelectedText)
-        //                {
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
-        //                    MenuItem highLightMenu = new MenuItem();
-        //                    highLightMenu.Header = "HighLight";
-        //                    highLightMenu.Click += (o, p) =>
-        //                    {
-        //                        TextHighlightAnnotArgs highLightArgs = new TextHighlightAnnotArgs();
-        //                        MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
-
-        //                        if (PDFAnnotationControl != null)
-        //                        {
-        //                            highLightArgs.Color = System.Windows.Media.Colors.Red;
-        //                            highLightArgs.Transparency = 1;
-        //                            PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-        //                            PDFViewControl.PDFView.SetToolParam(highLightArgs);
-        //                            PDFViewControl.PDFView.SetMouseMode(oldMode);
-        //                        }
-
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(highLightMenu);
-
-        //                    MenuItem underlineMenu = new MenuItem();
-        //                    underlineMenu.Header = "UnderLine";
-        //                    underlineMenu.Click += (o, p) =>
-        //                    {
-        //                        TextUnderlineAnnotArgs underlineArgs = new TextUnderlineAnnotArgs();
-        //                        MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
-
-        //                        if (PDFAnnotationControl != null)
-        //                        {
-        //                            underlineArgs.Color = System.Windows.Media.Colors.Red;
-        //                            underlineArgs.Transparency = 1;
-        //                            PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-        //                            PDFViewControl.PDFView.SetToolParam(underlineArgs);
-        //                            PDFViewControl.PDFView.SetMouseMode(oldMode);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(underlineMenu);
-
-        //                    MenuItem strikeOutMenu = new MenuItem();
-        //                    strikeOutMenu.Header = "StrikeOut";
-        //                    strikeOutMenu.Click += (o, p) =>
-        //                    {
-        //                        TextStrikeoutAnnotArgs strikeoutAnnotArgs = new TextStrikeoutAnnotArgs();
-        //                        MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
-
-        //                        if (PDFAnnotationControl != null)
-        //                        {
-        //                            strikeoutAnnotArgs.Color = System.Windows.Media.Colors.Red;
-        //                            strikeoutAnnotArgs.Transparency = 1;
-        //                            PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-        //                            PDFViewControl.PDFView.SetToolParam(strikeoutAnnotArgs);
-        //                            PDFViewControl.PDFView.SetMouseMode(oldMode);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(strikeOutMenu);
-
-        //                    MenuItem SquiggleMenu = new MenuItem();
-        //                    SquiggleMenu.Header = "Squiggle";
-        //                    SquiggleMenu.Click += (o, p) =>
-        //                    {
-        //                        TextSquigglyAnnotArgs squigglyAnnotArgs = new TextSquigglyAnnotArgs();
-        //                        MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
-
-        //                        if (PDFAnnotationControl != null)
-        //                        {
-        //                            squigglyAnnotArgs.Color = System.Windows.Media.Colors.Red;
-        //                            squigglyAnnotArgs.Transparency = 1;
-        //                            PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-        //                            PDFViewControl.PDFView.SetToolParam(squigglyAnnotArgs);
-        //                            PDFViewControl.PDFView.SetMouseMode(oldMode);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(SquiggleMenu);
-        //                }
-        //                else
-        //                {
-        //                    e.Handle = true;
-        //                    e.PopupMenu = new ContextMenu();
-
-        //                    e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
-        //                    e.PopupMenu.Items.Add(new Separator());
-
-        //                    MenuItem fitWidthMenu = new MenuItem();
-        //                    fitWidthMenu.Header = "Automatically Resize";
-        //                    fitWidthMenu.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(fitWidthMenu);
-
-        //                    MenuItem fitSizeMenu = new MenuItem();
-        //                    fitSizeMenu.Header = "Actual Size";
-        //                    fitSizeMenu.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(fitSizeMenu);
-
-        //                    MenuItem zoomInMenu = new MenuItem();
-        //                    zoomInMenu.Header = "Zoom In";
-        //                    zoomInMenu.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor + 0.01, true);
-        //                            PDFViewControl.PDFView?.Zoom(newZoom);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(zoomInMenu);
-
-        //                    MenuItem zoomOutMenu = new MenuItem();
-        //                    zoomOutMenu.Header = "Zoom Out";
-        //                    zoomOutMenu.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor - 0.01, false);
-        //                            PDFViewControl.PDFView?.Zoom(newZoom);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(zoomOutMenu);
-        //                    e.PopupMenu.Items.Add(new Separator());
-
-        //                    MenuItem singleView = new MenuItem();
-        //                    singleView.Header = "Single Page";
-        //                    singleView.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(singleView);
-
-        //                    MenuItem singleContinuousView = new MenuItem();
-        //                    singleContinuousView.Header = "Single Page Continuous";
-        //                    singleContinuousView.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(singleContinuousView);
-
-        //                    MenuItem doubleView = new MenuItem();
-        //                    doubleView.Header = "Two Pages";
-        //                    doubleView.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(doubleView);
-
-        //                    MenuItem doubleContinuousView = new MenuItem();
-        //                    doubleContinuousView.Header = "Two Pages Continuous";
-        //                    doubleContinuousView.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
-        //                        }
-        //                    };
-
-        //                    e.PopupMenu.Items.Add(doubleContinuousView);
-
-        //                    MenuItem resetFormMenu = new MenuItem();
-        //                    resetFormMenu.Header = "Reset Forms";
-        //                    resetFormMenu.Click += (o, p) =>
-        //                    {
-        //                        if (PDFViewControl != null)
-        //                        {
-        //                            PDFViewControl.PDFView?.ResetForm(null);
-        //                        }
-        //                    };
-        //                    e.PopupMenu.Items.Add(new Separator());
-        //                    e.PopupMenu.Items.Add(resetFormMenu);
-
-        //                }
-        //            }
-
-        //            else if (e.CommandTarget == TargetType.ImageSelection)
-        //            {
-        //                if (PDFViewControl != null && PDFViewControl.PDFView != null && PDFViewControl.PDFView.GetSelectImageCount() > 0)
-        //                {
-        //                    e.Handle = true;
-        //                    e.PopupMenu = new ContextMenu();
-
-        //                    MenuItem imageCopyMenu = new MenuItem();
-        //                    imageCopyMenu = new MenuItem();
-        //                    imageCopyMenu.Header = "Copy Images";
-        //                    WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageCopyMenu, "Click", CopyImage_Click);
-        //                    imageCopyMenu.CommandParameter = e;
-        //                    e.PopupMenu.Items.Add(imageCopyMenu);
-
-        //                    MenuItem imageExtraMenu = new MenuItem();
-        //                    imageExtraMenu = new MenuItem();
-        //                    imageExtraMenu.Header = "Extract Images";
-        //                    WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageExtraMenu, "Click", ExtraImage_Click);
-        //                    imageExtraMenu.CommandParameter = e;
-        //                    e.PopupMenu.Items.Add(imageExtraMenu);
-        //                }
-        //            }
-        //            break;
-        //        case CommandType.Copy:
-        //            e.DoCommand();
-        //            break;
-        //        case CommandType.Cut:
-        //        case CommandType.Paste:
-        //        case CommandType.Delete:
-        //            e.DoCommand();
-        //            break;
-        //        default:
-        //            break;
-        //    }
-        //}
-
-        //private void CopyImage_Click(object sender, RoutedEventArgs e)
-        //{
-        //    try
-        //    {
-        //        Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
-
-        //        if (imageDict != null && imageDict.Count > 0)
-        //        {
-        //            foreach (int pageIndex in imageDict.Keys)
-        //            {
-        //                List<Bitmap> imageList = imageDict[pageIndex];
-        //                foreach (Bitmap image in imageList)
-        //                {
-        //                    MemoryStream ms = new MemoryStream();
-        //                    image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
-        //                    BitmapImage imageData = new BitmapImage();
-        //                    imageData.BeginInit();
-        //                    imageData.StreamSource = ms;
-        //                    imageData.CacheOption = BitmapCacheOption.OnLoad;
-        //                    imageData.EndInit();
-        //                    imageData.Freeze();
-        //                    Clipboard.SetImage(imageData);
-        //                    break;
-        //                }
-        //            }
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-
-        //    }
-        //}
-
-        //private void ExtraImage_Click(object sender, RoutedEventArgs e)
-        //{
-        //    System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
-        //    if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-        //    {
-        //        string choosePath = folderDialog.SelectedPath;
-        //        string openPath = choosePath;
-        //        try
-        //        {
-        //            Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
-
-        //            if (imageDict != null && imageDict.Count > 0)
-        //            {
-        //                foreach (int pageIndex in imageDict.Keys)
-        //                {
-        //                    List<Bitmap> imageList = imageDict[pageIndex];
-        //                    foreach (Bitmap image in imageList)
-        //                    {
-        //                        string savePath = Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
-        //                        image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
-        //                        openPath = savePath;
-        //                    }
-        //                }
-        //            }
-        //            Process.Start("explorer", "/select,\"" + openPath + "\"");
-        //        }
-        //        catch (Exception ex)
-        //        {
-
-        //        }
-        //    }
-        //}
-
-        //#endregion
-
         #region UI
 
         private double CheckZoomLevel(double zoom, bool IsGrowth)
@@ -796,7 +454,7 @@ namespace Compdfkit_Tools.PDFControl
         private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
         {
             OnPropertyChanged(e.PropertyName);
-            if (e.PropertyName == "CanSave")
+            if (e.PropertyName == "CanUndo" || e.PropertyName == "CanRedo")
             {
                 OnCanSaveChanged?.Invoke(this, CanSave);
             }

+ 1 - 0
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs

@@ -27,6 +27,7 @@ namespace Compdfkit_Tools.PDFControl
             C_ANNOTATION_TYPE.C_ANNOTATION_SOUND,
             C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA
         };
+
         /// <summary>
         /// PDFViewer
         /// </summary>

+ 1 - 4
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListUI/CPDFAnnoationListUI.xaml.cs

@@ -142,7 +142,6 @@ namespace Compdfkit_Tools.PDFControlUI
             }
         }
 
-        /// <param name="results"></param>
         public void SetAnnotationList(List<BindAnnotationResult> results)
         {
             annotationList.Clear();
@@ -181,9 +180,7 @@ namespace Compdfkit_Tools.PDFControlUI
                 catch { }
             }
         }
-
-
-
+         
         public void CancelSelected()
         {
             AnnotationList.SelectedIndex = -1;

+ 17 - 60
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -18,14 +18,9 @@ using ComPDFKit.Tool;
 using ComPDFKit.Tool.Help;
 using ComPDFKit.Tool.SettingParam;
 using ComPDFKit.Import;
-using ComPDFKitViewer.BaseObject;
-using ComPDFKitViewer.Widget;
-using ComPDFKit.PDFDocument;
-using System.Text;
+using ComPDFKitViewer.BaseObject; 
 using ComPDFKitViewer.Helper;
-using ComPDFKit.Viewer.Helper;
-using System.Drawing.Imaging;
-using System.Reflection;
+using ComPDFKit.Viewer.Helper; 
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -150,8 +145,7 @@ namespace Compdfkit_Tools.PDFControl
         public void UnLoadPDFViewHandler()
         {
             if (this.pdfViewerControl != null)
-            {
-                //this.pdfViewerControl.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
+            { 
                 pdfViewerControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
             }
         }
@@ -446,33 +440,15 @@ namespace Compdfkit_Tools.PDFControl
                         annotHandlerEventArgs = stampParam;
                         pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
 
-                        stampParam.ImageStream.Seek(0, SeekOrigin.Begin);
-                        BitmapDecoder decoder = BitmapDecoder.Create(stampParam.ImageStream,
-                                BitmapCreateOptions.None,
-                                BitmapCacheOption.Default);
-                        BitmapFrame frame = null;
-                        if (decoder != null && decoder.Frames.Count > 0)
+                        byte[] imageData = null;
+                        int imageWidth = 0;
+                        int imageHeight = 0;
+                        PDFHelp.ImageStreamToByte(stampParam.ImageStream, ref imageData, ref imageWidth, ref imageHeight);
+                        if (imageData != null && imageWidth > 0 && imageHeight > 0)
                         {
-                            frame = decoder.Frames[0];
-                        }
-                        if (frame != null)
-                        {
-                            byte[] imageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                            if (frame.Format != PixelFormats.Bgra32)
-                            {
-                                FormatConvertedBitmap covert = new FormatConvertedBitmap(
-                                    frame,
-                                    PixelFormats.Bgra32,
-                                    frame.Palette,
-                                    0);
-                                covert.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
-                            }
-                            else
-                            {
-                                frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
-                            }
-                            pdfViewerControl.SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
+                            pdfViewerControl.SetStampMouseImage(imageData, imageWidth, imageHeight);
                         }
+
                         pdfViewerControl.SetIsVisibleCustomMouse(true);
                         pdfViewerControl.SetIsShowStampMouse(true);
                     }
@@ -482,38 +458,20 @@ namespace Compdfkit_Tools.PDFControl
                         AnnotParam signatureParam = new AnnotParam();
                         CPDFSignatureData SignatureData = pdfAnnotationData as CPDFSignatureData;
                         SetSignature(ref signatureParam, SignatureData);
-                        BitmapDecoder decoder = null;
                         switch (signatureParam.CurrentType)
                         {
                             case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
                                 {
                                     StampParam stampParam = (StampParam)signatureParam;
                                     stampParam.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_STAMP;
-                                    stampParam.ImageStream.Seek(0, SeekOrigin.Begin);
-                                    decoder = BitmapDecoder.Create(stampParam.ImageStream, BitmapCreateOptions.None, BitmapCacheOption.Default);
-                                    BitmapFrame frame = null;
-                                    pdfViewerControl.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP);
-                                    if (decoder != null && decoder.Frames.Count > 0)
-                                    {
-                                        frame = decoder.Frames[0];
-                                    }
-                                    if (frame != null)
+
+                                    byte[] imageData = null;
+                                    int imageWidth = 0;
+                                    int imageHeight = 0;
+                                    PDFHelp.ImageStreamToByte(stampParam.ImageStream, ref imageData, ref imageWidth, ref imageHeight);
+                                    if (imageData != null && imageWidth > 0 && imageHeight > 0)
                                     {
-                                        byte[] imageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                                        if (frame.Format != PixelFormats.Bgra32)
-                                        {
-                                            FormatConvertedBitmap covert = new FormatConvertedBitmap(
-                                                frame,
-                                                PixelFormats.Bgra32,
-                                                frame.Palette,
-                                                0);
-                                            covert.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
-                                        }
-                                        else
-                                        {
-                                            frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
-                                        }
-                                        pdfViewerControl.SetStampMouseImage(imageArray, frame.PixelWidth, frame.PixelHeight);
+                                        pdfViewerControl.SetStampMouseImage(imageData, imageWidth, imageHeight);
                                         pdfViewerControl.SetIsVisibleCustomMouse(true);
                                         pdfViewerControl.SetIsShowStampMouse(true);
                                         annotHandlerEventArgs = signatureParam;
@@ -945,7 +903,6 @@ namespace Compdfkit_Tools.PDFControl
                         {
                             using (FileStream stream = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                             {
-
                                 PngBitmapEncoder encoder = new PngBitmapEncoder();
                                 encoder.Frames.Add(BitmapFrame.Create(stream, BitmapCreateOptions.DelayCreation, BitmapCacheOption.None));
                                 MemoryStream memoryStream = new MemoryStream();

+ 12 - 20
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFSignatureUI.xaml.cs

@@ -15,6 +15,7 @@ using System.Windows.Data;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
 using Compdfkit_Tools.Helper;
+using ComPDFKit.Tool.Help;
 
 namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
 {
@@ -76,31 +77,22 @@ namespace Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
             }
         }
 
-        private void FillForm(string ImagePath)
+        private void FillForm(string imagePath)
         {
-            if (!string.IsNullOrEmpty(ImagePath))
+            if (!string.IsNullOrEmpty(imagePath))
             {
-                using (FileStream fileData = File.OpenRead(ImagePath))
+                byte[] imageData = null;
+                int imageWidth = 0;
+                int imageHeight = 0;
+                PDFHelp.ImagePathToByte(imagePath, ref imageData, ref imageWidth, ref imageHeight);
+                if (imageData != null && imageWidth > 0 && imageHeight > 0)
                 {
-                    BitmapFrame frame = null;
-                    BitmapDecoder decoder = BitmapDecoder.Create(fileData, BitmapCreateOptions.None, BitmapCacheOption.Default);
-                    if (decoder != null && decoder.Frames.Count > 0)
+                    if (signatureWidget != null && signatureWidget.IsValid())
                     {
-                        frame = decoder.Frames[0];
-                    }
-                    if (frame != null)
-                    {
-                        byte[] ImageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                        int ImageWidth = frame.PixelWidth;
-                        int ImageHeight = frame.PixelHeight;
-                        frame.CopyPixels(ImageArray, frame.PixelWidth * 4, 0);
-                        if(signatureWidget!=null && signatureWidget.IsValid())
+                        signatureWidget.UpdateApWithImage(imageData, imageWidth, imageHeight, C_Scale_Type.fitCenter, 0);
+                        if (viewControl != null && viewControl.PDFViewTool != null)
                         {
-                            signatureWidget.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
-                            if(viewControl!=null && viewControl.PDFViewTool!=null)
-                            {
-                                viewControl.UpdateAnnotFrame();
-                            }
+                            viewControl.UpdateAnnotFrame();
                         }
                     }
                 }

+ 1 - 8
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs

@@ -38,14 +38,7 @@ namespace Compdfkit_Tools.PDFControl
         public bool ReplaceFunctionEnabled
         {
             get;
-            set;
-            // set
-            // {
-            //     if (searchControl?.ReplaceTog != null)
-            //     {
-            //         searchControl.ReplaceTog.Visibility = value ? Visibility.Visible : Visibility.Collapsed;
-            //     }
-            // }
+            set; 
         }
 
         private Dictionary<BOTATools,ToggleButton> botaToolBtnDic;

+ 70 - 28
Demo/Examples/Compdfkit_Tools/DigitalSignature/FillDigitalSignatureControl/FillDigitalSignatureControl.xaml.cs

@@ -11,7 +11,7 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
 using System.Reflection;
-using System.Runtime.Remoting.Messaging;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Windows;
 using System.Windows.Controls;
@@ -20,8 +20,6 @@ using System.Windows.Ink;
 using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
-using Color = System.Drawing.Color;
 using Pen = System.Windows.Media.Pen;
 using PixelFormat = System.Windows.Media.PixelFormat;
 using Point = System.Windows.Point;
@@ -117,32 +115,25 @@ namespace Compdfkit_Tools.PDFControl
             tempSignatureConfig.IsDrawLogo = (bool)LogoChk.IsChecked;
             if (tempSignatureConfig.IsDrawLogo)
             {
-                using (FileStream fileData = File.OpenRead(logoPath))
+                if(!string.IsNullOrEmpty(logoPath))
                 {
-                    BitmapFrame frame = null;
-                    BitmapDecoder decoder = BitmapDecoder.Create(fileData, BitmapCreateOptions.None, BitmapCacheOption.Default);
-                    if (decoder != null && decoder.Frames.Count > 0)
-                    {
-                        frame = decoder.Frames[0];
-                    }
-                    if (frame != null)
+                    byte[] imageData = null;
+                    int imageWidth = 0;
+                    int imageHeight = 0;
+
+                    ComPDFKit.Tool.Help.PDFHelp.ImagePathToByte(logoPath, ref imageData, ref imageWidth, ref imageHeight);
+                    if (imageData != null && imageWidth > 0 && imageHeight > 0)
                     {
-                        byte[] imageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
-                        int ImageWidth = frame.PixelWidth;
-                        int ImageHeight = frame.PixelHeight;
-                        frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
-                        if(signatureWidget.IsValid())
+                        if (signatureWidget.IsValid())
                         {
-                            tempSignatureConfig.LogoData = imageArray;
-                            tempSignatureConfig.LogoWidth = ImageWidth;
-                            tempSignatureConfig.LogoHeight = ImageHeight;
-                            //signatureWidget.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
+                            tempSignatureConfig.LogoData = imageData;
+                            tempSignatureConfig.LogoWidth = imageWidth;
+                            tempSignatureConfig.LogoHeight = imageHeight;
                         }
                     }
                 }
-                
-                //tempSignatureConfig.LogoData = CommonHelper.ConvertBitmapToByteArray(new Bitmap(logoPath));
             }
+
             tempSignatureConfig.Content = Text;
             tempSignatureConfig.TextColor = textColor;
             tempSignatureConfig.ContentColor = new float[] { 0, 0, 0 };
@@ -237,7 +228,20 @@ namespace Compdfkit_Tools.PDFControl
                         ImagePickPanel.Visibility = Visibility.Visible;
                         if (!string.IsNullOrEmpty(imagePath))
                         {
-                            //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                            byte[] imageData = null;
+                            int imageWidth = 0;
+                            int imageHeight = 0;
+
+                            ComPDFKit.Tool.Help.PDFHelp.ImagePathToByte(imagePath, ref imageData, ref imageWidth, ref imageHeight);
+                            if (imageData != null && imageWidth > 0 && imageHeight > 0)
+                            {
+                                if (signatureWidget.IsValid())
+                                {
+                                    tempSignatureConfig.ImageData = imageData;
+                                    tempSignatureConfig.ImageWidth = imageWidth;
+                                    tempSignatureConfig.ImageHeight = imageHeight;
+                                }
+                            }
                         }
                     }
                 }
@@ -280,13 +284,17 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CanvasPopupConfirm_Click(object sender, RoutedEventArgs e)
         {
-            //tempSignatureConfig.ImageBitmap = GetDrawInk();
+            int height = 0;
+            int width = 0;
+            tempSignatureConfig.ImageData = GetDrawInk(ref height,ref width);
+            tempSignatureConfig.ImageWidth = width;
+            tempSignatureConfig.ImageHeight = height;
             CanvaDrawPopup.Visibility = Visibility.Collapsed;
             SetProperty();
             CreateTempSignature();
         }
 
-        public Bitmap GetDrawInk()
+        public byte[] GetDrawInk(ref int height, ref int width)
         {
             if (DrawInkCanvas != null && DrawInkCanvas.Strokes != null && DrawInkCanvas.Strokes.Count > 0)
             {
@@ -332,7 +340,10 @@ namespace Compdfkit_Tools.PDFControl
                 using (MemoryStream newStream = new MemoryStream())
                 {
                     pngEncoder.Save(newStream);
-                    return new Bitmap(newStream);
+                    Bitmap bitmap = new Bitmap(newStream);
+                    height = bitmap.Height;
+                    width = bitmap.Width;
+                    return GetBitmapData(bitmap);
                 }
             }
             else
@@ -341,6 +352,29 @@ namespace Compdfkit_Tools.PDFControl
             }
         }
 
+        private byte[] GetBitmapData(Bitmap bitmap)
+        {
+            // Lock the bitmap's bits.
+            Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
+            BitmapData bmpData = bitmap.LockBits(rect, ImageLockMode.ReadWrite, bitmap.PixelFormat);
+
+            // Get the address of the first line.
+            IntPtr ptr = bmpData.Scan0;
+
+            // Declare an array to hold the bytes of the bitmap.
+            int bytes = Math.Abs(bmpData.Stride) * bitmap.Height;
+
+            byte[] rgbValues = new byte[bytes];
+
+            // Copy the RGB values into the array.
+            System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
+
+            // Unlock the bits.
+            bitmap.UnlockBits(bmpData);
+
+            return rgbValues;
+        }
+        
         private void SetProperty()
         {
             Text = string.Empty;
@@ -461,10 +495,18 @@ namespace Compdfkit_Tools.PDFControl
             string pngPath = CommonHelper.GetExistedPathOrEmpty(filter);
             if (!string.IsNullOrEmpty(pngPath))
             {
-                imagePath = pngPath;
                 try
                 {
-                    //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
+                    byte[] imageData = null;
+                    int imageWidth = 0;
+                    int imageHeight = 0;
+                    ComPDFKit.Tool.Help.PDFHelp.ImagePathToByte(pngPath, ref imageData, ref imageWidth, ref imageHeight);
+                    if (imageData != null && imageWidth > 0 && imageHeight > 0)
+                    {
+                        tempSignatureConfig.ImageData = imageData;
+                        tempSignatureConfig.ImageWidth = imageWidth;
+                        tempSignatureConfig.ImageHeight = imageHeight;
+                    }
                 }
                 catch (Exception exception)
                 {

Разлика између датотеке није приказан због своје велике величине
+ 375 - 734
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs


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

@@ -21,14 +21,18 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using ComPDFKit.Tool.DrawTool;
 using ComPDFKitViewer.Helper;
+using ComPDFKit.Tool.Help;
 
 namespace Compdfkit_Tools.Edit
 {
     public partial class PDFImageEditControl : UserControl
     {
+        #region property
         public CPDFViewerTool ToolView { get; set; }
         public ImageEditParam EditEvent { get; set; }
+
         //public List<PDFEditEvent> EditMultiEvents { get; set; }
+        #endregion 
 
         public PDFImageEditControl()
         {
@@ -37,6 +41,8 @@ namespace Compdfkit_Tools.Edit
             Unloaded += PDFImageEditControl_Unloaded;
         }
 
+        #region Load unload custom control
+
         private void PDFImageEditControl_Loaded(object sender, RoutedEventArgs e)
         {
             RotateUI.RotationChanged -= RotateUI_RotationChanged;
@@ -47,6 +53,15 @@ namespace Compdfkit_Tools.Edit
             ToolView.SelectedDataChanged += ToolView_SelectedDataChanged;
         }
 
+        private void PDFImageEditControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            RotateUI.RotationChanged -= RotateUI_RotationChanged;
+            FlipUI.FlipChanged -= FlipUI_FlipChanged;
+        } 
+
+        #endregion
+
+        #region Property changed
         private void ToolView_SelectedDataChanged(object sender, SelectedAnnotData e)
         {
             if (ToolView.GetIsCropMode())
@@ -64,7 +79,7 @@ namespace Compdfkit_Tools.Edit
                     pdfRect = DpiHelper.StandardRectToPDFRect(pdfRect);
                     CRect newCRect = new CRect((float)pdfRect.Left, (float)pdfRect.Bottom, (float)pdfRect.Right, (float)pdfRect.Top);
                     imageArea.CutWithRect(newCRect);
-                    
+
                     SetImageThumb();
                     ToolView.UpdateRender(oldRect, imageArea);
                     editPage.EndEdit();
@@ -72,21 +87,61 @@ namespace Compdfkit_Tools.Edit
             }
         }
 
-        private void PDFImageEditControl_Unloaded(object sender, RoutedEventArgs e)
+
+        #endregion
+
+        #region Init PDFViewer
+        public void InitWithPDFViewer(CPDFViewerTool newPDFView)
         {
-            RotateUI.RotationChanged -= RotateUI_RotationChanged;
-            FlipUI.FlipChanged -= FlipUI_FlipChanged;
+            ToolView = newPDFView;
         }
+        #endregion
 
+        #region public method
 
         public void SetRotationText(float rotation)
         {
             RotationTxb.Text = rotation.ToString(CultureInfo.CurrentCulture);
         }
 
-        public void InitWithPDFViewer(CPDFViewerTool newPDFView)
+        #endregion
+
+        #region Image Edit
+
+        public void SetImageThumb()
         {
-            ToolView = newPDFView;
+            if (EditEvent != null)
+            {
+                try
+                {
+                    GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
+
+                    string path = Path.GetTempPath();
+                    string uuid = Guid.NewGuid().ToString("N");
+                    string imagePath = Path.Combine(path, uuid + ".tmp");
+                    imageArea.ExtractImage(imagePath);
+
+                    Bitmap bitmapImage = new Bitmap(imagePath);
+                    MemoryStream memoryStream = new MemoryStream();
+
+                    bitmapImage.Save(memoryStream, bitmapImage.RawFormat);
+                    BitmapImage imageShow = new BitmapImage();
+                    imageShow.BeginInit();
+                    imageShow.StreamSource = memoryStream;
+                    imageShow.EndInit();
+                    ImageThumbUI.Source = imageShow;
+                }
+                catch (Exception ex)
+                {
+
+                }
+            }
+        }
+
+        public void SetImageTransparency(double transparency)
+        {
+            ImasgeOpacitySlider.Value = transparency / 255D;
+            OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Round(ImasgeOpacitySlider.Value * 100)));
         }
 
         public void SetPDFImageEditData(ImageEditParam newEvent)
@@ -103,15 +158,18 @@ namespace Compdfkit_Tools.Edit
             {
                 SetImageTransparency(newEvent.Transparency);
             }
-            
-            if(RotationTxb!=null && newEvent!=null && newEvent.EditType == CPDFEditType.EditImage)
+
+            if (RotationTxb != null && newEvent != null && newEvent.EditType == CPDFEditType.EditImage)
             {
-                //RotationTxb.Text = newEvent.CurrentRotated.ToString(CultureInfo.CurrentCulture);
+                GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
+                RotationTxb.Text = imageArea.GetRotation().ToString();
+                //RotationTxb.Text = newEvent.Rotate.ToString(CultureInfo.CurrentCulture);
             }
-            
+
             EditEvent = newEvent;
             SetImageThumb();
         }
+        #endregion
 
         //public void SetPDFImageMultiEditData(List<PDFEditEvent> editEvents)
         //{
@@ -138,7 +196,7 @@ namespace Compdfkit_Tools.Edit
         //        ImageThumbUI.Source = null;
         //    }
 
-           
+
         //    if (editEvents != null && editEvents.Count > 0)
         //    {
         //        PDFEditEvent editEvent = editEvents[0];
@@ -151,6 +209,8 @@ namespace Compdfkit_Tools.Edit
         //    EditMultiEvents = editEvents;
         //}
 
+        #region Property changed
+
         private void FlipUI_FlipChanged(object sender, bool e)
         {
             GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
@@ -274,7 +334,7 @@ namespace Compdfkit_Tools.Edit
             //{
             //    foreach (PDFEditEvent editEvent in EditMultiEvents)
             //    {
-            //        editEvent.Transparency = (int)(ImasgeOpacitySlider.Value * 255);
+            //        editEvent.Transparency = (int)(ImageOpacitySlider.Value * 255);
             //    }
             //    PDFEditEvent.UpdatePDFEditList(EditMultiEvents);
             //}
@@ -332,43 +392,26 @@ namespace Compdfkit_Tools.Edit
                         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)
-                        {
-                            frame = decoder.Frames[0];
-                        }
-                        if (frame != null)
-                        {
-                            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;
-                        }
-                        Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
-                        CRect imageRect = imageArea.GetClipRect();
-                        if (imageArea.ReplaceImageArea(imageRect, imageData, imageWidth, imageHeight))
+                        PDFHelp.ImagePathToByte(openFileDialog.FileName, ref imageData, ref imageWidth, ref imageHeight);
+
+                        if (imageData != null && imageWidth > 0 && imageHeight > 0)
                         {
-                            PDFEditHistory editHistory = new PDFEditHistory();
-                            editHistory.EditPage = editPage;
-                            if (pdfPage != null)
+                            Rect oldRect = DataConversionForWPF.CRectConversionForRect(imageArea.GetFrame());
+                            CRect imageRect = imageArea.GetClipRect();
+                            if (imageArea.ReplaceImageArea(imageRect, imageData, imageWidth, imageHeight))
                             {
-                                editHistory.PageIndex = pdfPage.PageIndex;
-                            }
+                                PDFEditHistory editHistory = new PDFEditHistory();
+                                editHistory.EditPage = editPage;
+                                if (pdfPage != null)
+                                {
+                                    editHistory.PageIndex = pdfPage.PageIndex;
+                                }
 
-                            ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
-                            SetImageThumb();
-                            ToolView.UpdateRender(oldRect, imageArea);
-                            editPage.EndEdit();
+                                ToolView.GetCPDFViewer()?.UndoManager.AddHistory(editHistory);
+                                SetImageThumb();
+                                ToolView.UpdateRender(oldRect, imageArea);
+                                editPage.EndEdit();
+                            }
                         }
                     }
                 }
@@ -379,7 +422,6 @@ namespace Compdfkit_Tools.Edit
         {
             if (ToolView != null)
             {
-                //需要选中图片对象
                 // Dictionary<int, List<Bitmap>> imageDict = PDFView.GetSelectedImages();
                 Dictionary<int, List<Bitmap>> imageDict = new Dictionary<int, List<Bitmap>>();
                 if (imageDict != null && imageDict.Count > 0)
@@ -414,16 +456,6 @@ namespace Compdfkit_Tools.Edit
 
         private void ImageClipBtn_Click(object sender, RoutedEventArgs e)
         {
-            //if(EditMultiEvents!=null && EditMultiEvents.Count>1)
-            //{
-            //    return;
-            //}
-
-            //if (EditEvent != null)
-            //{
-            //    EditEvent.ClipImage = true;
-            //    EditEvent.UpdatePDFEditByEventArgs();
-            //}
             ToolView.SetCropMode(!ToolView.GetIsCropMode());
         }
 
@@ -440,42 +472,6 @@ namespace Compdfkit_Tools.Edit
             }
         }
 
-        public void SetImageThumb()
-        {
-            if (EditEvent != null)
-            {
-                try
-                {
-                    GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
-
-                    string path = Path.GetTempPath();
-                    string uuid = Guid.NewGuid().ToString("N");
-                    string imagePath = Path.Combine(path, uuid + ".tmp");
-                    imageArea.ExtractImage(imagePath);
-
-                    Bitmap bitmapImage = new Bitmap(imagePath);
-                    MemoryStream memoryStream = new MemoryStream();
-
-                    bitmapImage.Save(memoryStream, bitmapImage.RawFormat);
-                    BitmapImage imageShow = new BitmapImage();
-                    imageShow.BeginInit();
-                    imageShow.StreamSource = memoryStream;
-                    imageShow.EndInit();
-                    ImageThumbUI.Source = imageShow;
-                }
-                catch (Exception ex)
-                {
-
-                }
-            }
-        }
-
-        public void SetImageTransparency(double transparency)
-        {
-            ImasgeOpacitySlider.Value = transparency / 255D;
-            OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Round(ImasgeOpacitySlider.Value * 100)));
-        }
-
         private void GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage)
         {
             imageArea = null;
@@ -503,7 +499,7 @@ namespace Compdfkit_Tools.Edit
 
             }
         }
-        
+
         private void SetAbsRotation(double absRotation)
         {
             GetImageArea(out CPDFEditImageArea imageArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
@@ -527,10 +523,10 @@ namespace Compdfkit_Tools.Edit
                 }
             }
         }
-        
+
         private void RotationTxb_LostFocus(object sender, RoutedEventArgs e)
         {
-            if(!double.TryParse(RotationTxb.Text, out double rotation))
+            if (!double.TryParse(RotationTxb.Text, out double rotation))
             {
                 return;
             }
@@ -544,6 +540,6 @@ namespace Compdfkit_Tools.Edit
                 RotationTxb_LostFocus(null, null);
             }
         }
-
+        #endregion 
     }
 }

+ 4 - 0
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageUI/CPDFImageFlipUI.xaml.cs

@@ -12,6 +12,7 @@ namespace Compdfkit_Tools.Edit
             InitializeComponent();
         }
 
+        #region Property
         public Orientation Orientation
         {
             get
@@ -23,7 +24,9 @@ namespace Compdfkit_Tools.Edit
                 ImageFlipUI.Orientation = value;
             }
         }
+        #endregion
 
+        #region UI Event
         private void FlipVertical_Click(object sender, RoutedEventArgs e)
         {
             FlipChanged?.Invoke(this, true);
@@ -33,5 +36,6 @@ namespace Compdfkit_Tools.Edit
         {
             FlipChanged?.Invoke(this, false);
         }
+        #endregion 
     }
 }

+ 7 - 0
Demo/Examples/Compdfkit_Tools/Edit/PDFImageEdit/PDFImageUI/CPDFImageRotateUI.xaml.cs

@@ -6,6 +6,7 @@ namespace Compdfkit_Tools.Edit
 {
     public partial class CPDFImageRotateUI : UserControl
     {
+        #region 
         public event EventHandler<double> RotationChanged;
         public CPDFImageRotateUI()
         {
@@ -24,6 +25,10 @@ namespace Compdfkit_Tools.Edit
             }
         }
 
+        #endregion
+
+        #region 
+
         private void RotateLeftBtn_Click(object sender, RoutedEventArgs e)
         {
             RotationChanged?.Invoke(this, -90);
@@ -33,5 +38,7 @@ namespace Compdfkit_Tools.Edit
         {
             RotationChanged?.Invoke(this, 90);
         }
+
+        #endregion 
     }
 }

+ 19 - 1
Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml.cs

@@ -17,20 +17,28 @@ namespace Compdfkit_Tools.Edit
 {
     public partial class PDFTextEditControl : UserControl
     {
+        #region Property
         public CPDFViewerTool ToolView { get; private set; }
         public TextEditParam EditEvent { get; set; }
+
         //public List<PDFEditEvent> EditMultiEvents { get; set; }
+
+        #endregion 
+
         public PDFTextEditControl()
         {
             InitializeComponent();
             Loaded += PDFTextEditControl_Loaded;
         }
 
+        #region Init PDFView
         public void InitWithPDFViewer(CPDFViewerTool newPDFView)
         {
             ToolView = newPDFView;
         }
+        #endregion
 
+        #region UI
         public void SetPDFTextEditData(TextEditParam newEvent)
         {
             if (newEvent.EditIndex<0)
@@ -276,6 +284,9 @@ namespace Compdfkit_Tools.Edit
             //}
         }
 
+        #endregion
+
+        #region Loaded
         private void PDFTextEditControl_Loaded(object sender, RoutedEventArgs e)
         {
 
@@ -294,6 +305,10 @@ namespace Compdfkit_Tools.Edit
             FontColorUI.ColorChanged += FontColorUI_ColorChanged;
         }
 
+        #endregion
+
+        #region Property changed
+
         private void TextStyleUI_TextSizeChanged(object sender, double e)
         {
             GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage);
@@ -529,6 +544,9 @@ namespace Compdfkit_Tools.Edit
             }
         }
 
+        #endregion
+
+        #region Text Edit
         private void GetTextArea(out CPDFEditTextArea textArea, out CPDFPage pdfPage, out CPDFEditPage editPage)
         {
             textArea = null;
@@ -567,6 +585,6 @@ namespace Compdfkit_Tools.Edit
                 editPage.EndEdit();
             }
         }
-
+        #endregion
     }
 }

+ 11 - 2
Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextAlignUI.xaml.cs

@@ -9,13 +9,20 @@ namespace Compdfkit_Tools.Edit
 {
     public partial class CPDFTextAlignUI : UserControl
     {
+        #region Property
+
         public event EventHandler<TextAlignType> TextAlignChanged;
+
+        public TextAlignType Alignment { get; private set; }
+
+        #endregion
+
         public CPDFTextAlignUI()
         {
             InitializeComponent();
         }
 
-        public TextAlignType Alignment { get;private set; }
+        #region Property changed
 
         public void SetFontAlign(TextAlignType newAlign)
         {
@@ -82,5 +89,7 @@ namespace Compdfkit_Tools.Edit
                 }
             }
         }
+        
+        #endregion
     }
-}
+}

+ 11 - 0
Demo/Examples/Compdfkit_Tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml.cs

@@ -7,15 +7,21 @@ namespace Compdfkit_Tools.Edit
 {
     public partial class CPDFTextStyleUI : UserControl
     {
+        #region 
+        
         public event EventHandler<string> TextFontChanged;
         public event EventHandler<bool> TextBoldChanged;
         public event EventHandler<bool> TextItalicChanged;
         public event EventHandler<double> TextSizeChanged;
+
+        #endregion 
+
         public CPDFTextStyleUI()
         {
             InitializeComponent();
         }
 
+        #region  Set font name
         public void SetFontNames(List<string> fontNames)
         {
             FontNameComboBox.ItemsSource = null;
@@ -101,6 +107,9 @@ namespace Compdfkit_Tools.Edit
                 }
             }
         }
+        #endregion
+
+        #region Property changed
 
         private void FontNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
@@ -155,5 +164,7 @@ namespace Compdfkit_Tools.Edit
                 }
             }
         }
+        
+        #endregion 
     }
 }

+ 5 - 0
Demo/Examples/Compdfkit_Tools/Measure/MeasureControl.xaml.cs

@@ -459,6 +459,11 @@ namespace Compdfkit_Tools.Measure
         {
             InfoPanel?.SetMeasureType(measureType);
         }
+        
+        public void SetBOTAContainer(CPDFBOTABarControl botaControl)
+        {
+            this.BotaContainer.Child = botaControl;
+        }
 
         public void SetMeasureScale(CPDFMeasureType measureType, string scale)
         {

+ 2 - 11
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs

@@ -28,7 +28,7 @@ namespace Compdfkit_Tools.PDFControl
 
         private void ViewModeUI_SplitModeChanged(object sender, CPDFViewModeUI.SplitMode e)
         {
-            SplitModeChanged.Invoke(this, e);
+            SplitModeChanged?.Invoke(this, e);
         }
 
         private void ViewModeUI_CropModeChanged(object sender, bool e)
@@ -47,11 +47,6 @@ namespace Compdfkit_Tools.PDFControl
             }
         }
 
-        //private void ViewModeUI_SplitModeChanged(object sender, SplitMode e)
-        //{
-        //    ViewControl?.SetSplitMode(e);
-        //}
-
         private void ViewModeUI_ViewModeChanged(object sender, ViewMode e)
         {
             if (ViewControl != null && ViewControl.PDFViewTool != null)
@@ -75,8 +70,6 @@ namespace Compdfkit_Tools.PDFControl
                 if(pdfViewer != null)
                 {
                     ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode());
-                    // ViewModeUI.SetSplitModeUI(ViewControl.Mode);
-                    //ViewModeUI.SetCropUI(ViewControl.IsCropMode());
                 }
             }
             ViewModeUI.ViewModeChanged -= ViewModeUI_ViewModeChanged;
@@ -97,9 +90,7 @@ namespace Compdfkit_Tools.PDFControl
                 CPDFViewer pdfViewer = ViewControl.FocusPDFViewTool.GetCPDFViewer();
                 if (pdfViewer != null)
                 {
-                    ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode());
-                    // ViewModeUI.SetSplitModeUI(ViewControl.Mode);
-                    //ViewModeUI.SetCropUI(ViewControl.IsCropMode());
+                    ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode()); 
                 }
             }
         }

+ 8 - 0
Demo/Examples/Compdfkit_Tools/PDFView/PDFViewControl/PDFViewControl.xaml.cs

@@ -140,6 +140,14 @@ namespace Compdfkit_Tools.PDFControl
 
         private void PDFToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
         {
+            Point point = e.mouseButtonEventArgs.GetPosition(this);
+            viewerTool.GetCPDFViewer().GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
+            if(index == -1)
+            {
+                viewerTool.ContextMenu = null;
+                return;
+            }
+            PDFViewTool.SetPastePoint(point);
             MouseRightButtonDownHandler?.Invoke(sender, e);
         }
 

+ 1 - 2
Demo/Examples/Compdfkit_Tools/Watermark/AddWatermark/WatermarkDialog.xaml.cs

@@ -341,8 +341,7 @@ namespace Compdfkit_Tools.PDFControl
             weakReference = new WeakReference(this);
 
             FontFamilyCmb.ItemsSource = CPDFFont.GetFontNameDictionary().Keys;
-            FontFamilyCmb.SelectedIndex = 0;
-
+            FontFamilyCmb.SelectedIndex = 0; 
         }
 
         private void InitWatermarkData(ref WatermarkData watermarkData)

+ 15 - 3
Demo/Examples/DigitalSignature/DigitalSignature.csproj

@@ -131,6 +131,18 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\..\..\compdfkit_rebuild\ComPDFKit.Tool\ComPDFKit.Tool.csproj">
+      <Project>{a061ee7a-6704-4bd9-86ee-48ed5df75e2f}</Project>
+      <Name>ComPDFKit.Tool</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\compdfkit_rebuild\ComPDFKit.Viewer\ComPDFKit.Viewer.csproj">
+      <Project>{783263cf-0da3-4095-9df8-2c4a6b3ff908}</Project>
+      <Name>ComPDFKit.Viewer</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\compdfkit_windows\ComPDFKit\ComPDFKitCSharp\ComPDFKit.Desk.csproj">
+      <Project>{56e518ad-c126-4b48-9a09-0a64c87020e4}</Project>
+      <Name>ComPDFKit.Desk</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Compdfkit_Tools\Compdfkit_Tools.csproj">
       <Project>{9363bcb1-3a67-446a-8093-5708b86bf418}</Project>
       <Name>Compdfkit_Tools</Name>
@@ -149,10 +161,10 @@
     </BootstrapperPackage>
   </ItemGroup>
   <ItemGroup>
-    <None Include="..\license_key_windows.xml">
-      <Link>license_key_windows.xml</Link>
+    <Content Include="..\..\..\..\x64\ComPDFKit.dll">
+      <Link>x64\ComPDFKit.dll</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
+    </Content>
     <Content Include="..\TestFile\ComPDFKit_Signatures_Sample_File.pdf">
       <Link>ComPDFKit_Signatures_Sample_File.pdf</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

+ 1 - 1
Demo/Examples/PDFViewer/App.xaml.cs

@@ -62,7 +62,7 @@ namespace PDFViewer
             base.OnStartup(e);
              
             LicenseVerify();
-            CPDFSDKVerifier.PrintPermissions();
+            //CPDFSDKVerifier.PrintPermissions();
             //CPDFSDKVerifier.LicenseRefreshed -= CPDFSDKVerifier_LicenseRefreshed;
             //CPDFSDKVerifier.LicenseRefreshed += CPDFSDKVerifier_LicenseRefreshed;
             HistoryFile(@"TestFile\ComPDFKit_Sample_File_Windows.pdf");

+ 16 - 29
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -44,7 +44,7 @@ namespace PDFViewer
         public event EventHandler<string> AfterSaveAsFileEvent;
         public event PropertyChangedEventHandler PropertyChanged;
 
-        private bool _canSave = true;
+        private bool _canSave = false;
         /// <summary>
         /// Whether the save operation can be performed.
         /// </summary>
@@ -123,7 +123,7 @@ namespace PDFViewer
         public MainPage()
         {
             InitializeComponent();
-            this.DataContext = this; 
+            this.DataContext = this;
         }
         #endregion
 
@@ -162,13 +162,6 @@ namespace PDFViewer
                 SizeChanged -= MainPage_SizeChanged;
                 SizeChanged += MainPage_SizeChanged;
 
-                //viewControl.PDFView.Load();
-                //viewControl.PDFView.SetShowLink(true);
-
-                //viewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
-                //viewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
-
-                //viewControl.PDFView.SetFormFieldHighlight(true);
                 PasswordUI.Closed -= PasswordUI_Closed;
                 PasswordUI.Canceled -= PasswordUI_Canceled;
                 PasswordUI.Confirmed -= PasswordUI_Confirmed;
@@ -176,7 +169,6 @@ namespace PDFViewer
                 PasswordUI.Canceled += PasswordUI_Canceled;
                 PasswordUI.Confirmed += PasswordUI_Confirmed;
 
-                //viewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
                 CPDFSaclingControl.InitWithPDFViewer(viewControl);
                 ModeComboBox.SelectedIndex = 0;
 
@@ -500,7 +492,6 @@ namespace PDFViewer
                 {
                     PDFGrid.Child = regularViewerControl;
                     viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Viewer);
-                    //viewControl.PDFView.SetMouseMode(MouseModes.Viewer);
                     regularViewerControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     regularViewerControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     regularViewerControl.SetBOTAContainer(botaBarControl);
@@ -513,8 +504,6 @@ namespace PDFViewer
                 PDFGrid.Child = annotationControl;
 
                 viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.CreateAnnot);
-                //viewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                //annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
                 annotationControl.PDFViewControl = viewControl;
                 annotationControl.InitWithPDFViewer(viewControl);
                 if (annotationControl.PDFViewControl != null)
@@ -533,7 +522,7 @@ namespace PDFViewer
                 formControl.SetToolBarContainerVisibility(Visibility.Visible);
                 formControl.PdfViewControl = viewControl;
                 formControl.InitWithPDFViewer(viewControl);
-                if (formControl.PdfViewControl != null )
+                if (formControl.PdfViewControl != null)
                 {
                     PDFGrid.Child = formControl;
                     viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.WidgetEdit);
@@ -551,12 +540,8 @@ namespace PDFViewer
                 contentEditControl.PdfViewControl = viewControl;
                 contentEditControl.InitWithPDFViewer(viewControl);
                 displaySettingsControl.SetVisibilityWhenContentEdit(Visibility.Collapsed);
-                if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl!= null)
+                if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl != null)
                 {
-                    //viewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
-                    //viewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
-                    //viewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
-                    //viewControl.PDFView?.ReloadDocument();
 
                     PDFGrid.Child = contentEditControl;
                     viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.ContentEdit);
@@ -604,6 +589,7 @@ namespace PDFViewer
                     PDFGrid.Child = measureControl;
                     viewControl.PDFViewTool.SetViewerModel(MouseModes.PanTool);
                     measureControl.InitWithPDFViewer(viewControl);
+                    measureControl.SetBOTAContainer(botaBarControl);
                     GetPDFViewControl().PDFViewTool.GetDefaultSettingParam().IsOpenMeasure = true;
                 }
             }
@@ -665,7 +651,7 @@ namespace PDFViewer
 
             CPDFTitleBarControl.SaveFileEvent -= CPDFTitleBarControl_SaveFileEvent;
             CPDFTitleBarControl.SaveFileEvent += CPDFTitleBarControl_SaveFileEvent;
-            
+
             CPDFTitleBarControl.FlattenEvent -= CPDFTitleBarControl_FlattenEvent;
             CPDFTitleBarControl.FlattenEvent += CPDFTitleBarControl_FlattenEvent;
         }
@@ -680,12 +666,12 @@ namespace PDFViewer
                     if (CanSave)
                     {
                         SaveFile();
-                         
+
                         viewControl.PDFViewTool.IsDocumentModified = false;
                     }
                     CPDFDocument document = CPDFDocument.InitWithFilePath(viewControl.GetCPDFViewer().GetDocument().FilePath);
                     if (document?.WriteFlattenToFilePath(savePath) == true)
-                    {  
+                    {
                         System.Diagnostics.Process.Start("Explorer.exe", "/select," + savePath);
                     }
                     document?.Release();
@@ -745,6 +731,7 @@ namespace PDFViewer
         private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
         {
             SaveFile();
+            CanSave = false;
         }
 
         private void OpenFile(string filePath = "")
@@ -841,9 +828,9 @@ namespace PDFViewer
         {
             if (viewControl != null && viewControl.PDFViewTool != null)
             {
-                CPDFViewer pdfviewer=viewControl.PDFViewTool.GetCPDFViewer();
-                CPDFDocument pdfDoc=pdfviewer?.GetDocument();
-                if(pdfDoc==null)
+                CPDFViewer pdfviewer = viewControl.PDFViewTool.GetCPDFViewer();
+                CPDFDocument pdfDoc = pdfviewer?.GetDocument();
+                if (pdfDoc == null)
                 {
                     return;
                 }
@@ -985,15 +972,15 @@ namespace PDFViewer
                     double newZoom = CheckZoomLevel(pdfViewer.GetZoom() + 0.01, true);
                     pdfViewer.SetZoom(newZoom);
                 }
-            } 
+            }
         }
 
         private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
         {
-            if(viewControl!=null && viewControl.PDFViewTool!=null)
+            if (viewControl != null && viewControl.PDFViewTool != null)
             {
-                CPDFViewer pdfViewer= viewControl.PDFViewTool.GetCPDFViewer();
-                if(pdfViewer!=null)
+                CPDFViewer pdfViewer = viewControl.PDFViewTool.GetCPDFViewer();
+                if (pdfViewer != null)
                 {
                     double newZoom = CheckZoomLevel(pdfViewer.GetZoom() - 0.01, false);
                     pdfViewer.SetZoom(newZoom);

+ 2 - 0
Demo/Examples/Samples/AnnotationImportExportTest/CS/AnnotationImportExportTest.csproj

@@ -5,6 +5,8 @@
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
         <TargetFrameworks>net7.0;net461</TargetFrameworks>
     </PropertyGroup>
 

+ 38 - 0
Demo/Examples/Samples/AnnotationImportExportTest/CS/Properties/AssemblyInfo.cs

@@ -0,0 +1,38 @@
+#if NET451_OR_GREATER
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("AnnotationImportExportTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("PDF Technologies, Inc.")]
+[assembly: AssemblyProduct("BatesTest")]
+[assembly: AssemblyCopyright("Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9A19103F-16F7-4668-BE54-9A1E7A4F7556")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.13.0.0")]
+[assembly: AssemblyFileVersion("1.13.0.0")]
+#endif

+ 2 - 3
Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.cs

@@ -171,11 +171,10 @@ namespace AnnotationTest
         /// <param name="document"></param>
         static private void CreateSoundAnnotation(CPDFDocument document)
         {
-            CPDFPage page = document.PageAtIndex(0);
+            CPDFPage page = document.PageAtIndex(1);
             CPDFSoundAnnotation sound = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_SOUND) as CPDFSoundAnnotation;
             sound.SetRect(new CRect(400, 700, 450, 750));
-            // Note: The iconPath parameter is null.
-            sound.SetSoundPath("","Bird.wav");
+            sound.SetSoundPath(null,"Bird.wav");
             sound.UpdateAp();
         }
 

+ 3 - 2
Demo/Examples/Samples/AnnotationTest/CS/AnnotationTest.csproj

@@ -2,7 +2,8 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
@@ -56,7 +57,7 @@
   </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+      <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.6.0" />
     </ItemGroup>
 
 </Project>

+ 1 - 3
Demo/Examples/Samples/AnnotationTest/CS/Properties/AssemblyInfo.cs

@@ -1,5 +1,4 @@
-/*
-using System.Reflection;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -35,4 +34,3 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
-*/

+ 3 - 2
Demo/Examples/Samples/BackgroundTest/CS/BackgroundTest.csproj

@@ -2,7 +2,8 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
@@ -55,7 +56,7 @@
   </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+      <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.6.0" />
     </ItemGroup>
 
 </Project>

+ 2 - 4
Demo/Examples/Samples/BackgroundTest/CS/Properties/AssemblyInfo.cs

@@ -1,5 +1,4 @@
-/*
-using System.Reflection;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -34,5 +33,4 @@ using System.Runtime.InteropServices;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
-[assembly: AssemblyFileVersion("1.13.0.0")]
-*/
+[assembly: AssemblyFileVersion("1.13.0.0")]

+ 3 - 1
Demo/Examples/Samples/BatesTest/CS/BatesTest.csproj

@@ -1,10 +1,12 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/BookmarkTest/CS/BookmarkTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 20 - 11
Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.cs

@@ -1,22 +1,25 @@
 using ComPDFKit.DigitalSign;
 using ComPDFKit.Import;
-using ComPDFKit.PDFAnnotation;
 using ComPDFKit.PDFAnnotation.Form;
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Drawing;
 using System.IO;
+using System.Runtime.InteropServices;
+using System.Security.AccessControl;
 using System.Xml.Linq;
+using ImageMagick;
 
 namespace DigitalSignatureTest
 {
     internal class DigitalSignatureTest
     {
-
         static private string parentPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())));
         static private string outputPath = Path.Combine(parentPath, "Output", "CS");
+        static string trustedFolder = AppDomain.CurrentDomain.BaseDirectory + @"\TrustedFolder\";
 
         static void Main()
         {
@@ -31,6 +34,13 @@ namespace DigitalSignatureTest
             {
                 Directory.CreateDirectory(outputPath);
             }
+
+            if (!Directory.Exists(trustedFolder))
+            {
+                Directory.CreateDirectory(trustedFolder);
+            }
+            CPDFSignature.SignCertTrustedFolder = trustedFolder;
+            
             #endregion
 
             #region Sample 0: Create certificate 
@@ -97,7 +107,7 @@ namespace DigitalSignatureTest
 
             string info = "/C=SG/O=ComPDFKit/D=R&D Department/CN=Alan/emailAddress=xxxx@example.com";
             string password = "ComPDFKit";
-            string filePath = outputPath + "\\Certificate.pfx";
+            string filePath = "Certificate.pfx";
             if (CPDFPKCS12CertHelper.GeneratePKCS12Cert(info, password, filePath, CPDFCertUsage.CPDFCertUsageAll, true))
             {
                 Console.WriteLine("File saved in " + filePath);
@@ -165,11 +175,16 @@ namespace DigitalSignatureTest
                 "DN: " + DN + "\n",
                 IsContentAlignLeft = false,
                 IsDrawLogo = true,
-                // Note: No logo bitmap
-                //LogoBitmap = new Bitmap("Logo.png"),
                 TextColor = new float[] { 0, 0, 0 },
                 ContentColor = new float[] { 0, 0, 0 }
             };
+            using (var image = new MagickImage("Logo.png"))
+            {
+                byte[] byteArray = image.ToByteArray(MagickFormat.Bgra);
+                signatureConfig.LogoData = byteArray;
+                signatureConfig.LogoHeight = image.Height;
+                signatureConfig.LogoWidth = image.Width;
+            }
             string filePath = outputPath + "\\" + document.FileName + "_Signed.pdf";
             signatureField.UpdataApWithSignature(signatureConfig);
             if (document.WriteSignatureToFilePath(signatureField,
@@ -225,12 +240,6 @@ namespace DigitalSignatureTest
 
             Console.WriteLine("---Begin trusted---");
 
-            string trustedFolder = AppDomain.CurrentDomain.BaseDirectory + @"\TrustedFolder\";
-            if (!Directory.Exists(trustedFolder))
-            {
-                Directory.CreateDirectory(trustedFolder);
-            }
-            CPDFSignature.SignCertTrustedFolder = trustedFolder;
             if (signatureCertificate.AddToTrustedCertificates())
             {
                 Console.WriteLine("Certificate trusted status: " + signatureCertificate.IsTrusted.ToString());

+ 17 - 1
Demo/Examples/Samples/DigitalSignatureTest/CS/DigitalSignatureTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -33,6 +35,7 @@
       </Content>
       <Content Include="..\..\..\TestFile\Signed.pdf">
         <Link>Signed.pdf</Link>
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       </Content>
       <Content Include="..\..\ComPDFKit_Logo.ico">
         <Link>ComPDFKit_Logo.ico</Link>
@@ -51,4 +54,17 @@
     </ProjectReference>
   </ItemGroup>
 
+    <ItemGroup>
+      <None Update="Certificate.pfx">
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      </None>
+      <None Update="Logo.png">
+        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      </None>
+    </ItemGroup>
+
+    <ItemGroup>
+      <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.6.0" />
+    </ItemGroup>
+
 </Project>

+ 2 - 1
Demo/Examples/Samples/DocumentCompareTest/CS/DocumentCompareTest.csproj

@@ -2,7 +2,8 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>

+ 3 - 1
Demo/Examples/Samples/DocumentInfoTest/CS/DocumentInfoTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/EncryptTest/CS/EncryptTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/FlattenTest/CS/FlattenTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/HeaderFooterTest/CS/HeaderFooterTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/ImageExtractTest/CS/ImageExtractTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/InteractiveFormsTest/CS/InteractiveFormsTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/OutlineTest/CS/OutlineTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/PDFATest/CS/PDFATest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 3 - 1
Demo/Examples/Samples/PDFPageTest/CS/PDFPageTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 1 - 3
Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.cs

@@ -18,8 +18,7 @@ namespace PDFRedactTest
             SDKLicenseHelper.LicenseVerify();
 
             CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
-
-            // Note: replace Point to CPoint
+            
             string str = document.PageAtIndex(0).GetTextPage().GetSelectText(new CPoint(300, 240), new CPoint(400, 300), new CPoint(0, 0));
             Console.WriteLine("The text need to be redact is: {0}", str);
 
@@ -89,7 +88,6 @@ namespace PDFRedactTest
             CPDFDocument newDocument = CPDFDocument.InitWithFilePath(path);
 
             //Validation: try to get the text of the covered area
-            // Note: replace Point to CPoint
             string str = newDocument.PageAtIndex(0).GetTextPage().GetSelectText(new CPoint(60, 200), new CPoint(560, 250), new CPoint(0, 0));
             Console.WriteLine("Text in the redacted area is: {0}", str); 
             return true;

+ 3 - 1
Demo/Examples/Samples/PDFRedactTest/CS/PDFRedactTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 12 - 2
Demo/Examples/Samples/PDFToImage/CS/PDFToImageTest.csproj

@@ -1,6 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <LangVersion>7.3</LangVersion>
+    <Configurations>Release;Debug</Configurations>
+    <Platforms>AnyCPU;x64</Platforms>
+    <AssemblyName>Samples_ComPDFKit</AssemblyName>
+    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <TargetFramework>net7.0</TargetFramework>
+    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
+  </PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -59,6 +68,7 @@
       <Link>LicenseKey.cs</Link>
     </Compile>
     <Compile Include="PDFToImage.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\..\TestFile\CommonFivePage.pdf">

+ 36 - 0
Demo/Examples/Samples/PDFToImage/CS/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TextToImageTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("PDF Technologies, Inc.")]
+[assembly: AssemblyProduct("TextExtractTest")]
+[assembly: AssemblyCopyright("Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d255150-76cb-4a65-afea-f88778abf03b")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.13.0.0")]
+[assembly: AssemblyFileVersion("1.13.0.0")]

+ 2 - 1
Demo/Examples/Samples/PDFToImageTest/CS/PDFToImageTest.csproj

@@ -2,7 +2,8 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>

+ 3 - 1
Demo/Examples/Samples/TextExtractTest/CS/TextExtractTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 1 - 4
Demo/Examples/Samples/TextSearchTest/CS/Properties/AssemblyInfo.cs

@@ -1,6 +1,4 @@
-#if NET7_0
-#else
-using System.Reflection;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -36,4 +34,3 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
 [assembly: AssemblyFileVersion("1.13.0.0")]
-#endif

+ 3 - 1
Demo/Examples/Samples/TextSearchTest/CS/TextSearchTest.csproj

@@ -2,10 +2,12 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
+        <AssemblyName>Samples_ComPDFKit</AssemblyName>
     </PropertyGroup>
 
     <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

+ 2 - 5
Demo/Examples/Samples/WatermarkTest/CS/Properties/AssemblyInfo.cs

@@ -1,6 +1,4 @@
-#if NET7_0
-#else
-using System.Reflection;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -35,5 +33,4 @@ using System.Runtime.InteropServices;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.13.0.0")]
-[assembly: AssemblyFileVersion("1.13.0.0")]
-#endif
+[assembly: AssemblyFileVersion("1.13.0.0")]

+ 3 - 2
Demo/Examples/Samples/WatermarkTest/CS/WatermarkTest.csproj

@@ -2,7 +2,8 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net7.0</TargetFramework>
+        <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+        <TargetFrameworks>net7.0;net461</TargetFrameworks>
         <LangVersion>7.3</LangVersion>
         <Configurations>Release;Debug</Configurations>
         <Platforms>AnyCPU;x64</Platforms>
@@ -53,7 +54,7 @@
   </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="Magick.NET-Q8-x64" Version="13.6.0" />
+      <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.6.0" />
     </ItemGroup>
 
 </Project>