Browse Source

compdfkit(win) - feature list

liuaoran 1 year ago
parent
commit
56d4bf29f6

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Common/HomePage/FeaturesListControl.xaml

@@ -69,7 +69,7 @@
                 <RowDefinition></RowDefinition>
                 <RowDefinition  Height="auto"></RowDefinition>
             </Grid.RowDefinitions>
-            <ListBox  x:Name="FeaturesListBox" Style="{StaticResource WrapListBoxStyle}" ItemsSource="{Binding PageItems}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  SelectionMode="Single" d:ItemsSource="{d:SampleData ItemCount=5}">
+            <ListBox  x:Name="FeaturesListBox" Style="{StaticResource WrapListBoxStyle}" ItemsSource="{Binding PageItems}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  SelectionMode="Single">
                 <ListBox.ItemContainerStyle>
                     <Style TargetType="ListBoxItem">
                         <Setter Property="Margin" Value="{Binding ItemMargin}" />

File diff suppressed because it is too large
+ 296 - 29
Demo/Examples/Compdfkit_Tools/Common/HomePage/HomePageControl.xaml.cs


+ 6 - 0
Demo/Examples/Compdfkit_Tools/Security/Encryption/EncryptionDialog.xaml.cs

@@ -10,6 +10,7 @@ using System.Windows.Controls;
 using System.Windows.Forms;
 using Compdfkit_Tools.Common;
 using ComPDFKit.PDFDocument;
+using MessageBox = System.Windows.MessageBox;
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -52,6 +53,11 @@ namespace Compdfkit_Tools.PDFControl
 
         private void ButtonEncrypt_Click(object sender, RoutedEventArgs e)
         {
+            if(SetEncryptionControl.OwnerPassword == SetEncryptionControl.OwnerPassword)
+            {
+                MessageBox.Show("Open password and permission password must be different", "Warning", MessageBoxButton.OK);
+                return;
+            }
             var dialog = new FolderBrowserDialog();
             dialog.ShowDialog();
             var savePath = dialog.SelectedPath;

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

@@ -433,7 +433,7 @@ namespace Compdfkit_Tools.PDFControl
                 }
                 else
                 {
-                    watermarkData.Type = C_Watermark_Type.WATERMARK_TYPE_UNKWON;
+                    watermarkData.Type = C_Watermark_Type.WATERMARK_TYPE_UNKNOWN;
                 }
             }
         }

+ 2 - 2
Demo/Examples/Examlpes.sln

@@ -5,7 +5,7 @@ VisualStudioVersion = 17.5.33516.290
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "License", "License", "{43ED4BF9-5941-4F32-A9DC-016E94A0E74E}"
 	ProjectSection(SolutionItems) = preProject
-		license_key_windows.xml = license_key_windows.xml
+		license_key_windows.txt = license_key_windows.txt
 	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Viewer", "Viewer\Viewer.csproj", "{A25DD47F-1FDF-48A1-8D0E-8CFF2C066A74}"
@@ -103,7 +103,7 @@ EndProject
 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DocumentInfoTest", "Samples\DocumentInfoTest\VB\DocumentInfoTest.vbproj", "{9E6E96F8-C900-4374-A7A3-93481F733379}"
 EndProject
 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DocumentCompareTest", "Samples\DocumentCompare\VB\DocumentCompareTest.vbproj", "{F22C3E06-1B62-4516-AFC8-11F9B706206D}"
-=======
+EndProject
 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AnnotationTest", "Samples\AnnotationTest\VB\AnnotationTest.vbproj", "{AAE10F2E-F7B0-4487-BEDE-274CE74CA55E}"
 EndProject
 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BackgroundTest", "Samples\BackgroundTest\VB\BackgroundTest.vbproj", "{481B43E1-2183-4B34-8994-FFF58EA3B108}"

+ 2 - 3
Demo/Examples/PDFViewer/App.xaml.cs

@@ -36,10 +36,9 @@ namespace PDFViewer
             result = CPDFSDKVerifier.LoadNativeLibrary();
             if (!result)
                 return false;
-            SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
 
-            LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
-            if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
+            LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("license_key_windows.txt", true);
+            if (verifyResult != LicenseErrorCode.E_LICENSE_SUCCESS)
                 return false;
             return result;
         }

+ 52 - 22
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -117,7 +117,7 @@ namespace PDFViewer
                 OnPropertyChanged();
             }
         }
-        
+
         public MainPage()
         {
             InitializeComponent();
@@ -136,7 +136,7 @@ namespace PDFViewer
             pdfViewer = new PDFViewControl();
             pdfViewer.PDFView.InitDocument(filePath);
         }
-        
+
         public void InitWithDocument(CPDFDocument document)
         {
             pdfViewer = new PDFViewControl();
@@ -173,15 +173,15 @@ namespace PDFViewer
             ViewSettingBtn.IsChecked = false;
             botaBarControl.InitWithPDFViewer(pdfViewer.PDFView);
             ModeComboBox.SelectedIndex = 0;
-            botaBarControl.AddBOTAContent(new []{BOTATools.Thumbnail , BOTATools.Outline , BOTATools.Bookmark , BOTATools.Annotation , BOTATools.Search});
+            botaBarControl.AddBOTAContent(new[] { BOTATools.Thumbnail, BOTATools.Outline, BOTATools.Bookmark, BOTATools.Annotation, BOTATools.Search });
             botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
             botaBarControl.DeleteSignatureEvent -= BotaControlOnDeleteSignatureEvent;
             botaBarControl.DeleteSignatureEvent += BotaControlOnDeleteSignatureEvent;
             botaBarControl.ViewCertificateEvent -= digitalSignatureControl.ViewCertificateEvent;
             botaBarControl.ViewCertificateEvent += digitalSignatureControl.ViewCertificateEvent;
-            botaBarControl.ViewSignatureEvent -= digitalSignatureControl.ViewSignatureEvent;    
+            botaBarControl.ViewSignatureEvent -= digitalSignatureControl.ViewSignatureEvent;
             botaBarControl.ViewSignatureEvent += digitalSignatureControl.ViewSignatureEvent;
-            
+
             displaySettingsControl.InitWithPDFViewer(pdfViewer.PDFView);
             LoadCustomControl();
             panelState.PropertyChanged -= PanelState_PropertyChanged;
@@ -201,7 +201,37 @@ namespace PDFViewer
                 OnPropertyChanged(nameof(ViewSettingBtnIsChecked));
             }
         }
-        
+
+        public void SetFeatureMode(string featureName)
+        {
+            if (!string.IsNullOrEmpty(featureName))
+            {
+                switch (featureName)
+                {
+                    case "Viewer":
+                        ModeComboBox.SelectedIndex = 0;
+                        break;
+                    case "Annotations":
+                        ModeComboBox.SelectedIndex = 1;
+                        break;
+                    case "Forms":
+                        ModeComboBox.SelectedIndex = 2;
+                        break;
+                    case "Signature":
+                        ModeComboBox.SelectedIndex = 5;
+                        break;
+                    case "Document Editor":
+                        ModeComboBox.SelectedIndex = 4;
+                        break;
+                    case "Content Editor":
+                        ModeComboBox.SelectedIndex = 3;
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
         internal void SetPDFViewer(PDFViewControl newPdfViewer)
         {
             if (newPdfViewer != null)
@@ -266,7 +296,7 @@ namespace PDFViewer
         #endregion
 
         #region Load  custom control
-        
+
         /// <summary>
         /// Load the custom controls for the PDF viewer.
         /// </summary>
@@ -281,7 +311,7 @@ namespace PDFViewer
             regularViewerControl.SetBOTAContainer(botaBarControl);
             regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
             PDFGrid.Child = regularViewerControl;
-            
+
             SignatureHelper.InitEffectiveSignatureList(pdfViewer.PDFView.Document);
             SignatureHelper.VerifySignatureList(pdfViewer.PDFView.Document);
             digitalSignatureControl.LoadUndoManagerEvent(pdfViewer.PDFView);
@@ -318,7 +348,7 @@ namespace PDFViewer
         {
             OpenFile(e);
         }
-        
+
         /// <summary>
         /// Event handler for deleting a signature from the BOTA. Set the CanSave property to true and update the signature status.
         /// </summary>
@@ -329,7 +359,7 @@ namespace PDFViewer
             pdfViewer.PDFView.UndoManager.CanSave = true;
             DigitalSignatureControl_OnSignatureStatusChanged(sender, e);
         }
-        
+
         /// <summary>
         /// Event handler for updating a signature. Update the signature status.
         /// </summary>
@@ -356,7 +386,7 @@ namespace PDFViewer
         #endregion
 
         #region Private Command Event
-        
+
         /// <summary>
         /// Close all the expanded panels.  
         /// </summary>
@@ -378,16 +408,16 @@ namespace PDFViewer
             {
                 return;
             }
-            
+
             ClearPanelState();
-            if(ViewSettingBtn != null)
+            if (ViewSettingBtn != null)
                 ViewSettingBtn.IsChecked = false;
-            if(RightPanelButton != null)
+            if (RightPanelButton != null)
                 RightPanelButton.IsChecked = false;
 
-            if(pdfViewer!=null && pdfViewer.PDFView!=null)
+            if (pdfViewer != null && pdfViewer.PDFView != null)
             {
-               // pdfViewer.PDFView.ToolManager.EnableClickCreate = false;
+                // pdfViewer.PDFView.ToolManager.EnableClickCreate = false;
             }
 
             if (currentMode == "Viewer")
@@ -569,7 +599,7 @@ namespace PDFViewer
             LeftToolPanelButton.IsChecked = true;
             botaBarControl.SelectBotaTool(BOTATools.Search);
         }
-        
+
         private void CPDFTitleBarControl_Loaded(object sender, RoutedEventArgs e)
         {
             CPDFTitleBarControl.OpenFileEvent -= CPDFTitleBarControl_OpenFileEvent;
@@ -596,12 +626,12 @@ namespace PDFViewer
         {
             OpenFile();
         }
-        
+
         private void FileInfoCloseBtn_Click(object sender, RoutedEventArgs e)
         {
             PopupBorder.Visibility = Visibility.Collapsed;
         }
-        
+
         /// <summary>
         /// Refresh the annotation list when a annotation is edited.
         /// </summary>
@@ -621,12 +651,12 @@ namespace PDFViewer
         {
             this.CanSave = e;
         }
-        
+
         protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
         {
             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
         }
-        
+
         #endregion
 
         #region Open and Save file
@@ -727,7 +757,7 @@ namespace PDFViewer
                 try
                 {
                     CPDFDocument pdfDoc = pdfViewer.PDFView.Document;
-                    if(!string.IsNullOrEmpty(pdfDoc.FilePath))
+                    if (!string.IsNullOrEmpty(pdfDoc.FilePath))
                     {
                         if (pdfDoc.WriteToLoadedPath())
                         {

+ 2 - 2
Demo/Examples/PDFViewer/MainWindow.xaml

@@ -158,7 +158,7 @@
                                 <ColumnDefinition Width="*" />
                                 <ColumnDefinition Width="auto" />
                             </Grid.ColumnDefinitions>
-                            <Border  x:Name="TitleBd"  Width="184"  Height="32" Margin="0,3,0,-1" CornerRadius="5,5,0,0">
+                            <Border  x:Name="TitleBd"  Width="184"  Height="32" Margin="0,3,0,-2" CornerRadius="5,5,0,0">
                                 <Grid Background="Transparent">
                                     <Grid.ColumnDefinitions>
                                         <ColumnDefinition Width="auto" />
@@ -364,7 +364,7 @@
                 <ContentControl.Visibility>
                     <Binding Path="IsToggled" ElementName="HomePageButton" Converter="{StaticResource BoolToVisibleConverter}"></Binding>
                 </ContentControl.Visibility>
-                <cpdftools:HomePageControl x:Name="HomePageControl"></cpdftools:HomePageControl>
+                <cpdftools:HomePageControl x:Name="HomePageControl" Visibility="{Binding ElementName=customContentControl, Path=Visibility}"></cpdftools:HomePageControl>
             </ContentControl>
         </Grid>
 

+ 10 - 7
Demo/Examples/PDFViewer/MainWindow.xaml.cs

@@ -64,6 +64,10 @@ namespace PDFViewer
                 if (LoadLastOpenedDocuments())
                 {
                     TabControl.SelectedIndex = Properties.Settings.Default.LastSelectedFileIndex;
+                    if(TabControl.SelectedIndex == -1)
+                    {
+                        HomePageButton.IsToggled = true;
+                    }
                     Properties.Settings.Default.IsLoadLastFileNeeded = false;
                     Properties.Settings.Default.Save();
                 }
@@ -114,7 +118,7 @@ namespace PDFViewer
         {
             if (args.OperationType == FileOperationType.OpenFileDirectly)
             {
-                TabControlLoadDocument(args.FilePath);
+                TabControlLoadDocument(args.FilePath, args.FeatureName);
             }
             else if(args.OperationType == FileOperationType.CreateNewFile)
             {
@@ -169,7 +173,7 @@ namespace PDFViewer
             }
         }
 
-        private void TabControlLoadDocument(string filePath)
+        private void TabControlLoadDocument(string filePath, string featureName = "")
         {
             if (App.OpenedFilePathList.Contains(filePath))
             {
@@ -186,6 +190,7 @@ namespace PDFViewer
                             {
                                 win.Activate();
                                 item.IsSelected = true;
+                                (item.Content as MainPage).SetFeatureMode(featureName);
                                 return;
                             }
                         }
@@ -228,6 +233,9 @@ namespace PDFViewer
 
                 App.OpenedFilePathList.Add(filePath);
                 TabControl.Items.Add(tabItem);
+
+                viewPage.SetFeatureMode(featureName);
+
             }
         }
 
@@ -591,10 +599,5 @@ namespace PDFViewer
         {
             return TabControl.Items.Count <= 0;
         }
-
-        private void TabControl_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
-        {
-
-        }
     }
 }

+ 3 - 3
Demo/Examples/PDFViewer/PDFViewer.csproj

@@ -129,10 +129,10 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
-    <Content Include="..\license_key_windows.xml">
-      <Link>license_key_windows.xml</Link>
+    <None Include="..\license_key_windows.txt">
+      <Link>license_key_windows.txt</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
+    </None>
     <Content Include="..\TestFile\PDF32000_2008.pdf">
       <Link>PDF32000_2008.pdf</Link>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

File diff suppressed because it is too large
+ 8 - 0
Demo/Examples/PDFViewer/license_key_windows.txt


File diff suppressed because it is too large
+ 8 - 0
Demo/Examples/license_key_windows.txt


BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.10.0/build/x64/ComPDFKit.dll


BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.10.0/build/x86/ComPDFKit.dll


BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.10.0/lib/ComPDFKit.Desk.dll


BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.10.0/lib/ComPDFKit.Viewer.dll