Procházet zdrojové kódy

Merge branch 'dev' into beta

ZhouJieSheng před 1 rokem
rodič
revize
d332303ead
36 změnil soubory, kde provedl 780 přidání a 341 odebrání
  1. 5 0
      PDF Office/App.xaml.cs
  2. 9 1
      PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml
  3. 32 7
      PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs
  4. 84 0
      PDF Office/Helper/CommonHelper.cs
  5. 47 2
      PDF Office/Helper/ConverterHelper.cs
  6. 49 10
      PDF Office/Helper/EditHelper.cs
  7. 2 4
      PDF Office/Helper/FileComparisonHelper.cs
  8. 20 24
      PDF Office/Model/AnnotPanel/FontBoard.cs
  9. 6 1
      PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs
  10. 19 12
      PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs
  11. 24 0
      PDF Office/MultilingualResources/PDF Office.en.xlf
  12. 24 0
      PDF Office/MultilingualResources/PDF Office.zh-Hans.xlf
  13. 24 0
      PDF Office/MultilingualResources/PDF Office.zh-Hant.xlf
  14. binární
      PDF Office/Resources/GuidItems/GuidItem1.png
  15. binární
      PDF Office/Resources/GuidItems/GuidItem2.png
  16. binární
      PDF Office/Resources/GuidItems/GuidItem3.png
  17. binární
      PDF Office/Resources/GuidItems/GuidItem4.png
  18. binární
      PDF Office/Resources/GuidItems/GuidItem5.png
  19. binární
      PDF Office/Resources/GuidItems/GuidItem6.png
  20. 55 1
      PDF Office/Strings/MainPage/MainPage.Designer.cs
  21. 18 0
      PDF Office/Strings/MainPage/MainPage.resx
  22. 2 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs
  23. 2 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs
  24. 2 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs
  25. 2 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs
  26. 2 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs
  27. 3 1
      PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs
  28. 10 2
      PDF Office/ViewModels/Dialog/ConverterDialogs/OCRDownloadProgressViewModel.cs
  29. 53 45
      PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs
  30. 111 117
      PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs
  31. 116 63
      PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml
  32. 1 1
      PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml
  33. 7 3
      PDF Office/Views/Tools/TextEditToolContent.xaml
  34. 17 14
      UpdateXML/pdfmaster_win_en_Us.xml
  35. 17 14
      UpdateXML/pdfmaster_win_zh_Hans.xml
  36. 17 14
      UpdateXML/pdfmaster_win_zh_Hant.xml

+ 5 - 0
PDF Office/App.xaml.cs

@@ -179,6 +179,9 @@ namespace PDF_Master
         /// </summary>
         public static uint WebopenexpiredId;
 
+        //App当前系统语言
+        public static string CultureLanguage;
+
         /// <summary>
         /// 文案资源管理器  首页
         /// </summary>
@@ -210,6 +213,8 @@ namespace PDF_Master
             AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
             //Task线程内
             TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
+
+            CultureLanguage = System.Globalization.CultureInfo.CurrentUICulture.ToString();
         }
 
         private void InitSettings()

+ 9 - 1
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml

@@ -52,7 +52,15 @@
                         BorderBrush="#FFE2E3E6"
                         BorderThickness="1"
                         ItemTemplate="{StaticResource numberData}"
-                        MaxDropDownHeight="200" />
+                        MaxDropDownHeight="200"
+                        VirtualizingStackPanel.IsVirtualizing="True"
+                        VirtualizingStackPanel.VirtualizationMode="Standard">
+                        <ComboBox.ItemsPanel>
+                            <ItemsPanelTemplate>
+                                <VirtualizingStackPanel />
+                            </ItemsPanelTemplate>
+                        </ComboBox.ItemsPanel>
+                    </ComboBox>
 
                     <TextBox
                         x:Name="title"

+ 32 - 7
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs

@@ -37,9 +37,22 @@ namespace PDF_Master.CustomControl.CompositeControl
         //}
 
         //字符串类型的值
-        public string ValueStr { get; private set; }
-
-        //数字类型的值
+        //public string ValueStr { get;  set; }
+        private string valueStr;
+
+        public string ValueStr
+        {
+            get
+            {
+                return valueStr;
+            }
+            set
+            {
+                SetProperty(ref valueStr, value);
+            }
+        }
+
+        //数字类型的值
         public double Value { get; private set; }
 
         //public string Content { get; private set; }
@@ -161,8 +174,10 @@ namespace PDF_Master.CustomControl.CompositeControl
             {
                 title.Text = item.Content;
                 Trace.WriteLine("comBox_SelectionChanged" + title.Text);
-                SelectedIndex = comBox.SelectedIndex;
-
+                if (SelectedIndex != comBox.SelectedIndex)
+                {
+                    SelectedIndex = comBox.SelectedIndex;
+                }
                 if (IsValueContent == false)
                 {
                     Value = item.Value;
@@ -387,8 +402,18 @@ namespace PDF_Master.CustomControl.CompositeControl
                 if (control.comBox.Items != null && control.comBox.Items.Count > 0 )
                 {
                     control.comBox.SelectedIndex = selectedIndex;
-                    if (control.comBox.SelectedItem != null)
-                        control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
+                    if (control.comBox.SelectedItem != null)
+                    {
+                        if(control.comBox.SelectedItem is ComboDataItem comboDataItem)
+                        {
+                            bool isEqual = EqualityComparer<ComboDataItem>.Default.Equals(comboDataItem, control.SelectedItems);
+                            if (isEqual==false)
+                            {
+                                control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
+                            }
+                        }
+                    }
+                        
                   
                 }
                 control.UpdateSelectedIndex();

+ 84 - 0
PDF Office/Helper/CommonHelper.cs

@@ -4,6 +4,8 @@ using PDF_Master.ViewModels.Dialog.BOTA;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Diagnostics.Eventing.Reader;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -598,5 +600,87 @@ namespace PDF_Master.Helper
             Numbers = Numbers.OrderBy(a => a).ToList();
             Numbers.Reverse();
         }
+
+        /// <summary>
+        /// 获取系统语言列表
+        /// </summary>
+        /// <returns></returns>
+        public static CultureInfo[] cultureInfos()
+        {
+            return CultureInfo.GetCultures(CultureTypes.AllCultures);
+        }
+
+        /// <summary>
+        /// 语言缩写获取语言全称
+        /// </summary>
+        /// <param name="languageCode"></param>
+        /// <returns></returns>
+        public static string LanguageFullName(string languageCode = "en")
+        {
+
+            CultureInfo[] cultures = cultureInfos();
+
+            CultureInfo matchingCulture = cultures.FirstOrDefault(c => c.TwoLetterISOLanguageName.Equals(languageCode, StringComparison.InvariantCultureIgnoreCase));
+
+            if (matchingCulture != null)
+            {
+                string languageFullName = matchingCulture.EnglishName;
+                return languageFullName;
+            }
+            else
+            {
+                return languageCode;
+            }
+        }
+
+        /// <summary>
+        /// 语言与地区缩写获取语言名字(语言+地区)
+        /// </summary>
+        /// <param name="languageAndcountryCode"></param>
+        /// <returns></returns>
+        public static string LanguageAndCountryFullName(string languageAndcountryCode = "en-US")
+        {
+
+            try
+            {
+                CultureInfo culture = CultureInfo.GetCultureInfo(languageAndcountryCode);
+                string languageFullName = culture.DisplayName;
+                return languageFullName;
+            }
+            catch (CultureNotFoundException)
+            {
+                return languageAndcountryCode;
+            }
+        }
+
+        /// <summary>
+        /// 语言与地区缩写获取语言名字(语言+地区)
+        /// </summary>
+        /// <param name="languageAndcountryCode"></param>
+        /// <returns></returns>
+        public static string LanguageName(string languageAndcountryCode = "en-US")
+        {
+            string languageAndcountry =  LanguageAndCountryFullName(languageAndcountryCode);
+            if (languageAndcountry.Contains("Chinese")) {
+                if (languageAndcountry.Contains("Simplified")) {
+                    return "Chinese";
+                } 
+                else {
+                    return "ChineseTraditional";
+                }
+            }
+            else if (languageAndcountry.Contains("("))
+            {
+                string pattern = @"\([^()]*\)"; // 匹配括号以及其中的内容
+
+                string result = Regex.Replace(languageAndcountry, pattern, string.Empty);
+                return result;
+            }
+            else {
+                return languageAndcountry;
+            }
+            
+        }
+
     }
 }

+ 47 - 2
PDF Office/Helper/ConverterHelper.cs

@@ -17,6 +17,7 @@ using System.Windows;
 using System.Net.Mime;
 using System.Windows.Controls;
 using PDF_Master.Properties;
+using ComDocumentAIKit;
 
 namespace PDF_Master.Helper
 {
@@ -620,8 +621,52 @@ namespace PDF_Master.Helper
         /// 转档解锁跳转
         /// </summary>
         public static void convertUnlock()
-        {      
-                Process.Start(new ProcessStartInfo(ServiceHelper.WebHost + "/windows/store/master?email=" + Settings.Default.UserDate.Email));
+        {
+            Process.Start(new ProcessStartInfo(ServiceHelper.WebHost + "/windows/store/master?email=" + Settings.Default.UserDate.Email));
+        }
+
+        /// <summary>
+        /// 获取OCR枚举
+        /// </summary>
+        /// <returns></returns>
+        public static COCRLanguage GetCOCRLanguage()
+        {
+            try
+            {
+                string languageName = CommonHelper.LanguageName(App.CultureLanguage);
+                string enumString = "COCRLanguage" + languageName; // 要转换的字符串
+                COCRLanguage enumValue; // 目标枚举类型变量
+                bool success = Enum.TryParse(enumString, out enumValue);
+                if (success)
+                {
+                    return enumValue;
+                }
+                else
+                {
+                    return COCRLanguage.COCRLanguageEnglish;
+                }
+            }
+            catch
+            {
+                return COCRLanguage.COCRLanguageEnglish;
+            }
+
+        }
+
+        /// <summary>
+        /// 将OCR语言枚举转为int
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCOCRLanguageInt() {
+
+            if ((int)ConverterHelper.GetCOCRLanguage() <= 4)
+            {
+               return (int)ConverterHelper.GetCOCRLanguage();
+            }
+            else
+            {
+               return 2;
+            }
         }
 
     }

+ 49 - 10
PDF Office/Helper/EditHelper.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -8,6 +9,27 @@ namespace PDF_Master.Helper
 {
     public static class EditHelper
     {
+        /// <summary>
+        /// 字体更改失效:
+        ///MT Extra
+        ///Symbol
+        ///HoloLens MDL2 Assets
+        ///Wingdings
+        ///Wingdings 2
+        ///Wingdings 3
+        ///Webdings
+        ///ZWAdobeF
+        ///Algerian
+        ///Bookshelf Symbol 7
+        ///Castellar
+        ///Marlett
+        ///MS Outlook(adobe、万兴没效果)
+        ///MS Reference Specialty
+        ///Segoe Fluent Icons(adobe、万兴没效果)
+        ///Segoe MDL2 Assets(adobe、万兴没效果)
+        ///Stencil
+        /// 未选择 文本时候,暂时注释SDK 目前没有效果的字体
+        /// </summary>
         public static List<string> FontFamily { get; set; } = new List<string>
 {
     "Adobe Devanagari",
@@ -42,7 +64,7 @@ namespace PDF_Master.Helper
     "Gabriola",
     "Gadugi",
     "Georgia",
-    "HoloLens MDL2 Assets",
+    //"HoloLens MDL2 Assets",
     "Impact",
     "Indie Flower",
     "Ink Free",
@@ -55,11 +77,11 @@ namespace PDF_Master.Helper
     "MS Gothic",
     "MS PGothic",
     "MS UI Gothic",
-    "MT Extra",
+    //"MT Extra",
     "MV Boli",
     "Malgun Gothic",
     "Malgun Gothic Semilight",
-    "Marlett",
+    //"Marlett",
     "Microsoft Himalaya",
     "Microsoft JhengHei",
     "Microsoft JhengHei UI",
@@ -84,8 +106,8 @@ namespace PDF_Master.Helper
     "Roboto Condensed",
     "Roboto Slab",
     "Sans Serif Collection",
-    "Segoe Fluent Icons",
-    "Segoe MDL2 Assets",
+    //"Segoe Fluent Icons",
+    //"Segoe MDL2 Assets",
     "Segoe Print",
     "Segoe Script",
     "Segoe UI",
@@ -105,17 +127,17 @@ namespace PDF_Master.Helper
     "Sitka Subheading",
     "Sitka Text",
     "Sylfaen",
-    "Symbol",
+    //"Symbol",
     "Tahoma",
     "Times New",
     "Trebuchet MS",
     "Verdana",
-    "Webdings",
-    "Wingdings",
+    //"Webdings",
+    //"Wingdings",
     "Yu Gothic",
     "Yu Gothic UI",
     "Yu Gothic UI Semilight",
-    "ZWAdobeF",
+    //"ZWAdobeF",
     "等线",
     "仿宋",
     "黑体",
@@ -123,5 +145,22 @@ namespace PDF_Master.Helper
     "宋体",
     "微软雅黑"
 };
+
+        public static List<string> GetFontFamily()
+        {
+            return  FontFamily.OrderBy(item => IsChinese(item)).ThenBy(item => item).ToList();
+        }
+
+        private static bool IsChinese(string str)
+        {
+            foreach (char c in str)
+            {
+                if (c >= 0x4E00 && c <= 0x9FFF)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
     }
-}
+}

+ 2 - 4
PDF Office/Helper/FileComparisonHelper.cs

@@ -14,9 +14,9 @@ namespace PDF_Master.Helper
     public static class FileComparisonHelper
     {
 #if DEBUG
-        public static string URI_AppXml = "http://test-pdf-pro.kdan.cn:3021/downloads/pdfreaderprocast_win_en_Us.xml";
+        public static string URI_AppXml = "http://test-pdf-pro.kdan.cn:3021/downloads/pdfmaster_win_en_Us.xml";
 #else
-        public static string URI_AppXml = "https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win_en_Us.xml";
+        public static string URI_AppXml = "https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml";
 #endif
 
         private static string OCRmodelMD5 = "";
@@ -72,8 +72,6 @@ namespace PDF_Master.Helper
             string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
             if (Directory.Exists(folderPath))
             {
-                Settings.Default.AppProperties.OCRmodelMD5 = "65d21a699138c194f06a8640dd40a901";
-                Settings.Default.AppProperties.OCRFile_Url = "http://test-pdf-pro.kdan.cn:3021/downloads/OCREngine.zip";
                 if (!Getpdfreaderprocast())
                 {
                     return false;

+ 20 - 24
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -7,6 +7,7 @@ using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -45,13 +46,13 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref _fontFamilyItems, value);
             }
         }
+
         public List<ComboDataItem> FontStyleItems { get; protected set; }
         public List<ComboDataItem> FontSizeItems { get; protected set; }
         public List<ComboDataItem> PresetFontItems { get; protected set; }
 
         public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
 
-
         #endregion 变量
 
         #region 初始化下拉框或列表默认的数据
@@ -63,6 +64,7 @@ namespace PDF_Master.Model.AnnotPanel
             InitBase_FontStyles();
             InitBase_FontSize();
         }
+
         //预设字体大小
         private void InitBase_FontSize()
         {
@@ -84,7 +86,7 @@ namespace PDF_Master.Model.AnnotPanel
 
         //字体
         public void InitBase_FontFamilys()
-        { 
+        {
             FontFamilyItems = TextFont.GetFamilyEdit();
         }
 
@@ -111,7 +113,6 @@ namespace PDF_Master.Model.AnnotPanel
         /// 预设样式
         /// </summary>
 
-
         private int presetFontSelectedIndex;
 
         public int PresetFontSelectedIndex
@@ -122,7 +123,8 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref presetFontSelectedIndex, value);
             }
         }
-        private ComboDataItem _currentPresetFont=new ComboDataItem("Custom", "Custom");
+
+        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
 
         public ComboDataItem CurrentPresetFont
         {
@@ -187,28 +189,27 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref _currentFontFamily, value);
                 if (isChange)
                 {
-                    string str= _currentFontFamily.Content;
-                    if (_currentFontFamily.Content== "Times New Roman")
+                    string str = _currentFontFamily.Content;
+                    if (_currentFontFamily.Content == "Times New Roman")
                     {
                         str = "Times-Roman";
                     }
                     ChangedValue?.Invoke(str, FontSetModeType.FontFamilys);
-
                 }
                 SetProperty(ref _currentFontFamily, value);
                 if (value.Content != null)
                 {
-                    FontFamilySelectedIndex=FontFamilyItems.IndexOf(value);
+                    int index = FontFamilyItems.FindIndex(item => item.Content == value.Content);
+                    FontFamilySelectedIndex = index;
+                    Trace.WriteLine(index);
                 }
                 else
                 {
                     FontFamilySelectedIndex = 0;
                 }
-                
             }
         }
 
-
         private int fontFamilySelectedIndex = -1;
 
         public int FontFamilySelectedIndex
@@ -217,9 +218,9 @@ namespace PDF_Master.Model.AnnotPanel
             set
             {
                 SetProperty(ref fontFamilySelectedIndex, value);
-
             }
         }
+
         #endregion 字体样式
 
         #region 字体大小
@@ -234,6 +235,7 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref fontSizeSelectedIndex, value);
             }
         }
+
         //下拉框列表:字体大小
         private ComboDataItem _currentFontSize = new ComboDataItem(6);
 
@@ -319,11 +321,8 @@ namespace PDF_Master.Model.AnnotPanel
                         //FontSizeSelectedIndex = 0;
                         //FontSizeSelectedIndex = -1;
                         break;
-
                 }
-               
             }
-
         }
 
         #endregion 字体大小
@@ -356,12 +355,13 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref fontStyleSelectedIndex, value);
             }
         }
+
         private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
+
         public ComboDataItem CurrrentFontWeightStyle
         {
             get { return _currrentFontWeightStyle; }
 
-
             set
             {
                 bool isChange = IsEqualStrComboData(_currrentFontWeightStyle, value);
@@ -389,11 +389,7 @@ namespace PDF_Master.Model.AnnotPanel
                         FontStyleSelectedIndex = 3;
                         break;
                 }
-
-
             }
-
-
         }
 
         protected void UpdateFontWeight_Style()
@@ -539,6 +535,7 @@ namespace PDF_Master.Model.AnnotPanel
                 uiStr = "Times New Roman";
             }
             //WPF的UI字体不包含Helvetica
+
             if (fontFamily == "Helvetica")
             {
                 fontFamily = "Arial";
@@ -550,8 +547,6 @@ namespace PDF_Master.Model.AnnotPanel
         #endregion 列表选中赋值
     }
 
-
-
     //设置字体大小、字体内容排版、字体颜色、字体样式、字重
     public class FontBoardVm : BindableBase
     {
@@ -699,6 +694,7 @@ namespace PDF_Master.Model.AnnotPanel
                     case "Times New Roman":
                         FontFamilySelectedIndex = 2;
                         break;
+
                     case "Adobe Devanagari":
                         FontFamilySelectedIndex = 3;
                         break;
@@ -1013,9 +1009,9 @@ namespace PDF_Master.Model.AnnotPanel
             //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
             foreach (var item in PresetFontList)
             {
-                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight==FontWeights.Bold) && annot.IsItalic == (item.mFontStyle==FontStyles.Italic)
-                    && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Arial")
-                    )
+                if (annot.FontSize == item.mFontSize && annot.IsBold == (item.mFontWeight == FontWeights.Bold) && annot.IsItalic == (item.mFontStyle == FontStyles.Italic)
+                && (annot.FontName == item.mFontFamily.Source || annot.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
+                )
                 {
                     if (item.mTag != "Custom")
                     {

+ 6 - 1
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -21,7 +21,12 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
     {
         public COCRLanguage OCRLanguage = COCRLanguage.COCRLanguageEnglish;
         public bool IsAllowOCR = false;
-        public bool IsContainOCRBgImage = true;
+
+        /// <summary>
+        /// 开启ocr时是否选择包含ocr底图
+        /// 如果包含 ,PDF转HTML的时候,ocr,会重叠
+        /// </summary>
+        public bool IsContainOCRBgImage = false;
         public bool IsContainAnnotations = true;
         public bool IsContainImages = true;
         public ContentOptions ContentOpts = ContentOptions.AllContent;

+ 19 - 12
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -5,6 +5,7 @@ using PDF_Master.Properties;
 using PDFSettings;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -335,7 +336,6 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             return FontSizeItems;
         }
 
-
         public static List<ComboDataItem> GetFamily()
         {
             var FontFamilyItems = new List<ComboDataItem>();
@@ -345,8 +345,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             FontFamilyItems.Add(item);
             item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
             FontFamilyItems.Add(item);
-            return FontFamilyItems;
-
+            return FontFamilyItems;
         }
 
         public static List<ComboDataItem> GetFamilyEdit()
@@ -354,19 +353,27 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();
             var FontFamilyItems = new List<ComboDataItem>();
             ComboDataItem item;
-            foreach (var itemFam in EditHelper.FontFamily)
-            {
-                item = new ComboDataItem(DeleteCharacters(itemFam),itemFam);
-                FontFamilyItems.Add(item);
 
+            foreach (var itemFam in EditHelper.GetFontFamily())
+            {
+                string content = itemFam;
+                if (itemFam.Equals("Informal"))
+                {
+                    content = "Informal Roman";
+                }
+                if (itemFam.Equals("Marlett"))
+                {
+                    continue;
+                }
+                item = new ComboDataItem(DeleteCharacters(itemFam), content);
+                FontFamilyItems.Add(item);
             }
-            return FontFamilyItems;
-
-        }
-
+            return FontFamilyItems;
+        }
+
         public static string DeleteCharacters(string str)
         {
-            str=str.Replace(" ", string.Empty);
+            str = str.Replace(" ", string.Empty);
             str = str.Replace("-", string.Empty);
             str = str.Replace("_", string.Empty);
             return str;

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.en.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hans.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 24 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hant.xlf

@@ -3520,6 +3520,30 @@ Some functions may not work, please restart or re-download PDF Reader Pro from o
           <source>Save Failed</source>
           <target state="new">Save Failed</target>
         </trans-unit>
+        <trans-unit id="OCR_CancelDownload" translate="yes" xml:space="preserve">
+          <source>Cancel</source>
+          <target state="new">Cancel</target>
+        </trans-unit>
+        <trans-unit id="OCR_Download" translate="yes" xml:space="preserve">
+          <source>Download</source>
+          <target state="new">Download</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadError" translate="yes" xml:space="preserve">
+          <source>Download failed</source>
+          <target state="new">Download failed</target>
+        </trans-unit>
+        <trans-unit id="OCR_Downloading" translate="yes" xml:space="preserve">
+          <source>Downloading OCR, please wait...</source>
+          <target state="new">Downloading OCR, please wait...</target>
+        </trans-unit>
+        <trans-unit id="OCR_DownloadRedownload" translate="yes" xml:space="preserve">
+          <source>Redownload</source>
+          <target state="new">Redownload</target>
+        </trans-unit>
+        <trans-unit id="OCR_PleaseDownload" translate="yes" xml:space="preserve">
+          <source>Please download OCR component first</source>
+          <target state="new">Please download OCR component first</target>
+        </trans-unit>
       </group>
     </body>
   </file>

binární
PDF Office/Resources/GuidItems/GuidItem1.png


binární
PDF Office/Resources/GuidItems/GuidItem2.png


binární
PDF Office/Resources/GuidItems/GuidItem3.png


binární
PDF Office/Resources/GuidItems/GuidItem4.png


binární
PDF Office/Resources/GuidItems/GuidItem5.png


binární
PDF Office/Resources/GuidItems/GuidItem6.png


+ 55 - 1
PDF Office/Strings/MainPage/MainPage.Designer.cs

@@ -19,7 +19,7 @@ namespace PDF_Master.Strings.MainPage {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     public class MainPage {
@@ -1417,6 +1417,60 @@ namespace PDF_Master.Strings.MainPage {
             }
         }
         
+        /// <summary>
+        ///   查找类似 Cancel 的本地化字符串。
+        /// </summary>
+        public static string OCR_CancelDownload {
+            get {
+                return ResourceManager.GetString("OCR_CancelDownload", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Download 的本地化字符串。
+        /// </summary>
+        public static string OCR_Download {
+            get {
+                return ResourceManager.GetString("OCR_Download", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Download failed 的本地化字符串。
+        /// </summary>
+        public static string OCR_DownloadError {
+            get {
+                return ResourceManager.GetString("OCR_DownloadError", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Downloading OCR, please wait... 的本地化字符串。
+        /// </summary>
+        public static string OCR_Downloading {
+            get {
+                return ResourceManager.GetString("OCR_Downloading", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Redownload 的本地化字符串。
+        /// </summary>
+        public static string OCR_DownloadRedownload {
+            get {
+                return ResourceManager.GetString("OCR_DownloadRedownload", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Please download OCR component first 的本地化字符串。
+        /// </summary>
+        public static string OCR_PleaseDownload {
+            get {
+                return ResourceManager.GetString("OCR_PleaseDownload", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 Opacity 的本地化字符串。
         /// </summary>

+ 18 - 0
PDF Office/Strings/MainPage/MainPage.resx

@@ -611,6 +611,24 @@ You can also add files or folders via the lower left button.</value>
   <data name="NoPrinter_Warning" xml:space="preserve">
     <value>Printer busy or error</value>
   </data>
+  <data name="OCR_CancelDownload" xml:space="preserve">
+    <value>Cancel</value>
+  </data>
+  <data name="OCR_Download" xml:space="preserve">
+    <value>Download</value>
+  </data>
+  <data name="OCR_DownloadError" xml:space="preserve">
+    <value>Download failed</value>
+  </data>
+  <data name="OCR_Downloading" xml:space="preserve">
+    <value>Downloading OCR, please wait...</value>
+  </data>
+  <data name="OCR_DownloadRedownload" xml:space="preserve">
+    <value>Redownload</value>
+  </data>
+  <data name="OCR_PleaseDownload" xml:space="preserve">
+    <value>Please download OCR component first</value>
+  </data>
   <data name="Opacity_Title" xml:space="preserve">
     <value>Opacity</value>
     <comment>点击水滴按钮打开的透明度弹窗标题</comment>

+ 2 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterExcelDialogViewModel.cs

@@ -379,7 +379,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -764,6 +764,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 2 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterHTMLDialogViewModel.cs

@@ -201,7 +201,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -522,6 +522,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 2 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterPPTDialogViewModel.cs

@@ -229,7 +229,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -551,6 +551,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 2 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterRTFDialogViewModel.cs

@@ -201,7 +201,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -520,6 +520,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 2 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterTextDialogViewModel.cs

@@ -202,7 +202,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                     alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -522,6 +522,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 3 - 1
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs

@@ -16,6 +16,7 @@ using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Windows;
@@ -235,7 +236,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 else
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("想用OCR,就去下载吧!", "", "取消", "确定");
+                    alertsMessage.ShowDialog(App.MainPageLoader.GetString("OCR_PleaseDownload"), "", App.MainPageLoader.GetString("OCR_CancelDownload"), App.MainPageLoader.GetString("OCR_Download"));
                     if (alertsMessage.result == ContentResult.Ok)
                     {
                         FileComparisonHelper.RemoveOCRModel();
@@ -578,6 +579,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 {
                     LimitationsConvertVisible = Visibility.Visible;
                 }
+                LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
         #endregion

+ 10 - 2
PDF Office/ViewModels/Dialog/ConverterDialogs/OCRDownloadProgressViewModel.cs

@@ -162,6 +162,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         {
             CancelCommand = new DelegateCommand(cancel);
             TryAgainCommnad = new DelegateCommand(tryAgain);
+            SetLangText();
         }
 
         private async void tryAgain()
@@ -277,7 +278,14 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         foreach (var entry in zip.Entries)
                         {
                             var extractionPath = System.IO.Path.Combine(destinationFolderPath, entry.FullName);
-
+                            string replacement = "OCREngine";
+                            //提换文件夹名字保证文件夹统一
+                            int slashIndex = entry.FullName.IndexOf('/');
+                            if (slashIndex != -1)
+                            {
+                                string modifiedString = replacement + entry.FullName.Substring(slashIndex);
+                                extractionPath = System.IO.Path.Combine(destinationFolderPath, modifiedString);
+                            }
                             if (entry.Name == "")
                             {
                                 // 处理目录的情况,例如在ZIP文件中的文件夹
@@ -325,7 +333,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                             {
                                 Directory.Delete(folderPath, true);
                             }
-                            MessageBoxEx.Show("需要更新最新版的APP才能下载哦");
+                            //MessageBoxEx.Show("需要更新最新版的APP才能下载哦");
 
                         }
 

+ 53 - 45
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -14,6 +14,7 @@ using Prism.Mvvm;
 using Prism.Regions;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -21,6 +22,7 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
+using static Dropbox.Api.Files.WriteMode;
 
 namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 {
@@ -237,26 +239,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         {
                             if (CurrentFontFamily.ValueStr != item.mFontFamily.Source)
                             {
-                                string txt = string.Format($" * {currentItem.mTagContent}");
-
-                                if (Title == txt)
+                                if (noAddAnAsterisk(currentItem, item) == false)
                                 {
-                                    Title = "";
+                                    break;
                                 }
-                                Title = txt;
-                                break;
                             }
                             else
                             {
-                                if (FontWeightItem == item.mFontWeight && FontStyleItem == item.mFontStyle && CurrentFontSize.Value == item.mFontSize && CurrentFontFamily.ValueStr == item.mFontFamily.Source)
+                                if (noAddAnAsterisk(currentItem, item) == false)
                                 {
-                                    string txt = currentItem.mTagContent;
-
-                                    if (Title == txt)
-                                    {
-                                        Title = "";
-                                    }
-                                    Title = txt;
+                                    break;
                                 }
                             }
                         }
@@ -265,6 +257,37 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             }
         }
 
+        private bool noAddAnAsterisk(PresetFontItem currentItem, PresetFontItem item)
+        {
+            if (FontWeightItem == item.mFontWeight && FontStyleItem == item.mFontStyle && CurrentFontSize.Value == item.mFontSize && (CurrentFontFamily.ValueStr == item.mFontFamily.Source || (CurrentFontFamily.ValueStr == "Arial" && item.mFontFamily.Source == "Helvetica")))
+            {
+                string txt = currentItem.mTagContent;
+
+                if (Title == txt)
+                {
+                    Title = "";
+                }
+                Title = txt;
+                return true;
+            }
+            else
+            {
+                addAnAsterisk(currentItem);
+                return false;
+            }
+        }
+
+        private void addAnAsterisk(PresetFontItem currentItem)
+        {
+            string txt = string.Format($" * {currentItem.mTagContent}");
+
+            if (Title == txt)
+            {
+                Title = "";
+            }
+            Title = txt;
+        }
+
         /// <summary>
         /// 设置文本字重、样式
         /// </summary>
@@ -658,15 +681,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
             if (PDFViewer != null)
             {
-               
+
                 if (TextEditEventList != null && TextEditEventList.Count > 0)
                 {
                     TextEditEvent = TextEditEventList[0];
-                    if(TextEditEvent.FontName!=""&& TextEditEvent.FontName !=null)
+                    if (TextEditEvent.FontName != "" && TextEditEvent.FontName != null)
                     {
                         GetPDFEdit();
                     }
-                    
+
                     if (TextEditEventList.Count > 1)
                         IsSelectedEmpty = true;
                     else
@@ -688,39 +711,24 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                         IsLayoutAvgAlign = false;
                     }
                 }
-                else if(TextEditEventList==null|| TextEditEvent.FontName == null|| TextEditEvent.FontName == "")
+                else if (TextEditEventList == null || TextEditEvent.FontName == null || TextEditEvent.FontName == "")
                 {
                     var defaultlists = TextFont.GetPresetFontStyle();
-
-                        //var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
-                        //if (defaulItem != null)
-                        //{
-                            var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == "Custom");
-                            if (currentItem != null)
-                            {
-                           
-
-                                //currentItem.mTagContent = defaulItem.mTagContent;
-                                //currentItem.mFontStyle = defaulItem.mFontStyle;
-                                //currentItem.mFontWeight = defaulItem.mFontWeight;
-                                //currentItem.mFontFamily = defaulItem.mFontFamily;
-                                //currentItem.mFontSize = defaulItem.mFontSize;
-                                GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
-                                GetCurrentFontSize(currentItem.mFontSize);
-                                GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);                           
-                                SelectedPresetFont();
-
-                            SelectColor = new SolidColorBrush(Colors.Black);
-                            CurrentFontSize = new ComboDataItem(currentItem.mFontSize);
+                    var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == "Custom");
+                    if (currentItem != null)
+                    {
+                        SelectColor = new SolidColorBrush(Colors.Black);
+                        CurrentFontSize = new ComboDataItem(currentItem.mFontSize);
                         CurrentPresetFont = new ComboDataItem(currentItem.mTag, currentItem.mTagContent);
                         CurrentFontFamily = new ComboDataItem(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
-                            FontStyleItem = FontStyles.Normal;
-                            FontWeightItem = FontWeights.Normal;
-                            
-                        //}
-                        
-                    }
+                        FontStyleItem = FontStyles.Normal;
+                        FontWeightItem = FontWeights.Normal;
 
+                        GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
+                        GetCurrentFontSize(currentItem.mFontSize);
+                        GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
+                        SelectedPresetFont();
+                    }
                 }
 
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;

+ 111 - 117
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -28,30 +28,39 @@ using System.Windows.Media.Imaging;
 using PDFReader_WPF.Helper;
 using PDF_Master.Properties;
 using PDF_Master.Model.AnnotPanel;
+using System.Diagnostics;
 
 namespace PDF_Master.ViewModels.Tools
 {
-    public class TextEditToolContentViewModel: BindableBase, INavigationAware
+    public class TextEditToolContentViewModel : BindableBase, INavigationAware
     {
         #region 属性与变量
+
         public ViewContentViewModel viewContentViewModel;
         private CPDFViewer PDFViewer;
         private IEventAggregator events;
         private IRegionManager regions;
+
         /// <summary>
         /// 用于区分事件的唯一码
         /// </summary>
         private string unicode;
+
         private Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
 
         private bool _isTextEdit = false;
+
         public bool IsTextEdit
         {
             get { return _isTextEdit; }
-            set { SetProperty(ref _isTextEdit, value);
+            set
+            {
+                SetProperty(ref _isTextEdit, value);
             }
         }
+
         private bool _isImgEdit = false;
+
         public bool IsImgEdit
         {
             get { return _isImgEdit; }
@@ -61,7 +70,8 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
-        private bool _flg=false;
+        private bool _flg = false;
+
         public bool flg
         {
             get { return _flg; }
@@ -72,6 +82,7 @@ namespace PDF_Master.ViewModels.Tools
         /// 替换图片指令
         /// </summary>
         private bool _ReplaceImgflg = false;
+
         public bool ReplaceImgflg
         {
             get { return _ReplaceImgflg; }
@@ -82,32 +93,39 @@ namespace PDF_Master.ViewModels.Tools
         /// 完成裁剪图片指令
         /// </summary>
         private bool _CropImgflg = false;
+
         public bool CropImgflg
         {
             get { return _CropImgflg; }
             set { SetProperty(ref _CropImgflg, value); }
         }
+
         /// <summary>
         /// 刷新预览图片指令
         /// </summary>
         private bool _REImgflg = false;
+
         public bool REImgflg
         {
             get { return _REImgflg; }
             set { SetProperty(ref _REImgflg, value); }
         }
-        #endregion
+
+        #endregion 属性与变量
 
         #region Command
+
         // 添加文本、图像
         public DelegateCommand<object> AddContentCommand { get; set; }
+
         public DelegateCommand AddTextCommand { get; set; }
         public DelegateCommand AddImgCommand { get; set; }
         public DelegateCommand EditTextModeCommand { get; set; }
 
-        #endregion
+        #endregion Command
 
         #region 初始化
+
         public TextEditToolContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
         {
             events = eventAggregator;
@@ -116,6 +134,7 @@ namespace PDF_Master.ViewModels.Tools
             InitCommand();
             InitBtnToProperty();
         }
+
         private void InitCommand()
         {
             AddContentCommand = new DelegateCommand<object>(AddContent);
@@ -132,7 +151,8 @@ namespace PDF_Master.ViewModels.Tools
             btnToProperty.Add("PropertyPanelContentEdit", "PropertyPanelContentEdit");
         }
 
-        #endregion
+        #endregion 初始化
+
         #region 右键菜单
 
         //点击空白处时
@@ -155,7 +175,7 @@ namespace PDF_Master.ViewModels.Tools
         {
             var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
             CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
-         
+
             //复制
             customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
             //剪切
@@ -169,7 +189,7 @@ namespace PDF_Master.ViewModels.Tools
 
             return popMenu;
         }
-       
+
         //选中文字内容
         private ContextMenu SelectTextContent(object sender)
         {
@@ -209,10 +229,11 @@ namespace PDF_Master.ViewModels.Tools
             ////删除
             //customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
 
-
             return popMenu;
         }
-        #endregion
+
+        #endregion 右键菜单
+
         #region 图片右键菜单
 
         //选中图像时
@@ -252,6 +273,7 @@ namespace PDF_Master.ViewModels.Tools
             customMenu.SetMenuBinding(2, new DelegateCommand(RestoreCropImg));
             return popMenu;
         }
+
         //多选图片右键
         private ContextMenu SelectMoreImage(object sender)
         {
@@ -268,11 +290,13 @@ namespace PDF_Master.ViewModels.Tools
             //导出
             customMenu.SetMenuBinding(4, new DelegateCommand(ExportImg));
 
-
             return popMenu;
         }
-        #endregion
+
+        #endregion 图片右键菜单
+
         #region 快捷键
+
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)
         {
             try
@@ -284,35 +308,33 @@ namespace PDF_Master.ViewModels.Tools
                         //缩小esc的操作范围
                         if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditText)
                         {
-                            if(PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditText) ==0)
-                            {
-                              PDFViewer.RemovePDFEditEmptyText(); 
-                            //只有在有画框的时候才进行
-                            if (PDFViewer.MouseMode == MouseModes.PDFEdit&& PDFViewer.ToolManager.HasTool == true)
+                            if (PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditText) == 0)
                             {
-                                PDFViewer.RemoveTool(false);
-                            }
-                            else if (IsTextEdit == true || IsImgEdit == true)
-                            {
-                                IsImgEdit = false;
-                                IsTextEdit = false;
-                                PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
+                                PDFViewer.RemovePDFEditEmptyText();
+                                //只有在有画框的时候才进行
+                                if (PDFViewer.MouseMode == MouseModes.PDFEdit && PDFViewer.ToolManager.HasTool == true)
+                                {
+                                    PDFViewer.RemoveTool(false);
+                                }
+                                else if (IsTextEdit == true || IsImgEdit == true)
+                                {
+                                    IsImgEdit = false;
+                                    IsTextEdit = false;
+                                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
 
-                                //文本和图像都框选
-                                PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
-                                PDFViewer.SetMouseMode(MouseModes.PDFEdit);                           
-                                PDFViewer.ReloadDocument();
-                                ShowPropertyPanel(false);
-                            }
+                                    //文本和图像都框选
+                                    PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
+                                    PDFViewer.SetMouseMode(MouseModes.PDFEdit);
+                                    PDFViewer.ReloadDocument();
+                                    ShowPropertyPanel(false);
+                                }
                             }
                             {
                                 PDFViewer.ClearSelectPDFEdit();
                                 PDFViewer.RemovePDFEditEmptyText();
                                 PDFViewer.ReloadDocument();
                             }
-                          
                         }
-
                         else if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                         {
                             if (PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditImage) == 0)
@@ -341,32 +363,21 @@ namespace PDF_Master.ViewModels.Tools
                                 PDFViewer.ReloadDocument();
                             }
                         }
-                        
                         else if (PDFViewer.ToolManager != null)
                         {
                             PDFViewer.ClearSelectPDFEdit();
                             AddToPropertyPanel("PropertyPanelContentEdit", null);
                             PDFViewer.ReloadDocument();
-
                         }
-
-
-
                     }
                 }
-
-
-
             }
             catch
             {
-
             }
-           
-          
-
         }
-        #endregion
+
+        #endregion 快捷键
 
         //模式选择进入
         public void AddContent(object obj)
@@ -378,21 +389,21 @@ namespace PDF_Master.ViewModels.Tools
                 IsImgEdit = false;
                 IsTextEdit = false;
                 PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.None);
-                PDFViewer.ReloadDocument();              
+                PDFViewer.ReloadDocument();
                 App.mainWindowViewModel.OpenLogin();
                 return;
             }
             var btn = obj as CustomIconToggleBtn;
             EnterEditMode((bool)btn.IsChecked, btn.Tag.ToString());
         }
+
         //编辑按钮逻辑,暂时保留
         private void EditTextMode()
         {
-
         }
-        
+
         //对应模式的逻辑
-        private void EnterEditMode(bool isCheckMode,string modeType)
+        private void EnterEditMode(bool isCheckMode, string modeType)
         {
             if (isCheckMode)
             {
@@ -411,6 +422,10 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
+                    //单击添加文本
+                    PDFViewer.ToolManager.EnableClickCreate = true;
+                    PDFViewer.ToolManager.ClickCreateWidth = 60;
+                    PDFViewer.ToolManager.ClickCreateHeight = 30;
                     AddToPropertyPanel("Text", null);
                     ShowPropertyPanel(true);
                 }
@@ -429,9 +444,12 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
+                    //未设置,将无法触发Active事件
+                    PDFViewer.ToolManager.EnableClickCreate = true;
+                    PDFViewer.ToolManager.ClickCreateWidth = 60;
+                    PDFViewer.ToolManager.ClickCreateHeight = 30;
                     AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(true);
-                    
                 }
             }
             else
@@ -445,7 +463,6 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                 PDFViewer.ReloadDocument();
                 ShowPropertyPanel(false);
-
             }
         }
 
@@ -460,12 +477,12 @@ namespace PDF_Master.ViewModels.Tools
         {
             EnterEditMode(true, "Image");
         }
+
         //进入裁剪模式
         private void CropMode()
         {
             if (TextEditEvent != null)
             {
-              
                 TextEditEvent.ClipImage = true;
                 TextEditEvent.UpdatePDFEditByEventArgs();
                 flg = true;
@@ -492,16 +509,14 @@ namespace PDF_Master.ViewModels.Tools
                 TextEditEvent.RestoreClip();
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
             }
-            
         }
 
         //完成裁剪
         private void CropImg()
         {
-
             CropImgflg = true;
-          
         }
+
         //导出图片
         private void ExportImg()
         {
@@ -530,16 +545,19 @@ namespace PDF_Master.ViewModels.Tools
                 CommonHelper.ShowFileBrowser(strFilePath);
             }
         }
-            //替换图片
-            private void ReplaceImg()
+
+        //替换图片
+        private void ReplaceImg()
         {
             ReplaceImgflg = true;
         }
 
-      
         //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
-        public System.Windows.Media.Imaging.BitmapSource CurrentImg { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
+
+        public System.Windows.Media.Imaging.BitmapSource CurrentImg
+        { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
+
         private void GetImagePreView()
         {
             try
@@ -564,21 +582,17 @@ namespace PDF_Master.ViewModels.Tools
                         System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                         CurrentImg = bitmapSource;
                     }
-
                 }
             }
             catch
             {
-
             }
-
         }
-        #endregion
-
 
+        #endregion Command功能
 
         //传参数给属性面板
-        private void AddToPropertyPanel(string type,  List<PDFEditEvent> e)
+        private void AddToPropertyPanel(string type, List<PDFEditEvent> e)
         {
             if (btnToProperty.ContainsKey(type))
             {
@@ -591,11 +605,11 @@ namespace PDF_Master.ViewModels.Tools
                     regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
                 }));
 
-                if(e!=null)
+                if (e != null)
                 {
                     ShowPropertyPanel(true);
                 }
-                else if(e==null&&IsImgEdit==false&&IsTextEdit==false)
+                else if (e == null && IsImgEdit == false && IsTextEdit == false)
                 {
                     ShowPropertyPanel(false);
                 }
@@ -625,13 +639,12 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 else
                 {
-
                     PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.None);
                     PDFViewer.ReloadDocument();
-
                 }
             }
         }
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
@@ -648,7 +661,6 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
                 PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
 
-
                 //图片添加
                 PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
                 PDFViewer.CustomNotifyHandler += PDFViewer_CustomNotifyHandler;
@@ -665,14 +677,15 @@ namespace PDF_Master.ViewModels.Tools
         private void PDFViewer_PDFEditHandler(object sender, List<PDFEditSelectionData> e)
         {
             PDFViewer.ClearSelectPDFEdit();
-            PDFViewer.SelectPDFEdit(e,true);
+            PDFViewer.SelectPDFEdit(e, true);
         }
 
         protected PDFEditEvent TextEditEvent;
+
         //左键激活逻辑
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
-            PDFViewer.ToolManager.IgnoreMoveDistance =5;
+            PDFViewer.ToolManager.IgnoreMoveDistance = 5;
             //判断是否已退出登录,限制编辑操作
             if (!App.IsLogin)
             {
@@ -685,12 +698,11 @@ namespace PDF_Master.ViewModels.Tools
             }
             if (e != null && e.Count > 0)
             {
-                TextEditEvent=e[0];
+                TextEditEvent = e[0];
                 bool isText = false;
                 bool isImg = false;
                 foreach (var item in e)
                 {
-
                     if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                     {
                         isImg = true;
@@ -701,42 +713,36 @@ namespace PDF_Master.ViewModels.Tools
                         isText = true;
                     }
                 }
-               
-              
 
                 if (isText == true && isImg == false)
                 {
                     AddToPropertyPanel("Text", e);
-                  
                 }
                 if (isText == false && isImg == true)
                 {
                     AddToPropertyPanel("Image", e);
-                 
                 }
                 if (isText == true && isImg == true)
                 {
                     AddToPropertyPanel("TextAndImage", e);
-                   
                 }
             }
-
-            else if(IsTextEdit==true)
-            {
-                //单击添加文本
-                PDFViewer.ToolManager.EnableClickCreate = true;
-                PDFViewer.ToolManager.ClickCreateWidth = 60;
-                PDFViewer.ToolManager.ClickCreateHeight = 30;
-                AddToPropertyPanel("Text", null);
-            }
+            ///未事先设置 if里面的内容,单击添加文本会失败
+            //else if(IsTextEdit==true)
+            //{
+            //    //单击添加文本
+            //    PDFViewer.ToolManager.EnableClickCreate = true;
+            //    PDFViewer.ToolManager.ClickCreateWidth = 60;
+            //    PDFViewer.ToolManager.ClickCreateHeight = 30;
+            //    AddToPropertyPanel("Text", null);
+            //}
             else
             {
-
+                Trace.WriteLine("PropertyPanelContentEdit");
                 AddToPropertyPanel("PropertyPanelContentEdit", null);
             }
 
             events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
-
         }
 
         //右键点击逻辑
@@ -752,34 +758,28 @@ namespace PDF_Master.ViewModels.Tools
                     if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)//点击空白区域
                     {
                         e.PopupMenu = EmptyStateMenu(sender);
-
                     }
                     else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
-
-                         
                         //文字编辑
                         if (e.PressOnBorder == true)
                         {
                             e.PopupMenu = SelectTextBorder(sender);
                         }
-
-                         else if(e.PressOnSelectedText == true)
+                        else if (e.PressOnSelectedText == true)
                         {
                             e.PopupMenu = SelectTextContent(sender);
                         }
-
-                        else if(e.SelectText=="")
+                        else if (e.SelectText == "")
                         {
-                            e.PopupMenu= EditTextContent(sender);
+                            e.PopupMenu = EditTextContent(sender);
                         }
                         else
                         {
                             e.PopupMenu = SelectTextContent(sender);
                         }
-
                     }
-                   else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                     {
                         if (e.IsClipState == true)
                         {
@@ -789,15 +789,13 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             e.PopupMenu = SelectImgPDFEdit(sender);
                         }
-
                     }
-                  
-                        break;
+
+                    break;
 
                 default:
                     e.DoCommand();
                     break;
-
             }
             if (e.PopupMenu != null)
             {
@@ -806,7 +804,6 @@ namespace PDF_Master.ViewModels.Tools
             flg = e.IsClipState;
         }
 
-
         //图片添加逻辑
         private void PDFViewer_CustomNotifyHandler(object sender, CustomNotityData e)
         {
@@ -814,15 +811,15 @@ namespace PDF_Master.ViewModels.Tools
             if (e.NotifyType == CustomNotifyType.PDFEditImageCreate)
             {
                 OpenFileDialog openFileDialog = new OpenFileDialog();
-                    openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
-                    if (openFileDialog.ShowDialog() == true)
-                    {                 
-                    PDFViewer.AddPDFEditImage(CompressImage(openFileDialog.FileName, 800), 500,500);
+                openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                if (openFileDialog.ShowDialog() == true)
+                {
+                    PDFViewer.AddPDFEditImage(CompressImage(openFileDialog.FileName, 800), 500, 500);
                     events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
                 }
-                }
+            }
             //图片调整大小
-            else if(e.NotifyType == CustomNotifyType.PDFEditImageResize)
+            else if (e.NotifyType == CustomNotifyType.PDFEditImageResize)
             {
                 REImgflg = true;
                 events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
@@ -884,7 +881,6 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
-
         /// <summary>
         ///  根据图片数据判断图片类型
         /// </summary>
@@ -908,7 +904,6 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 catch
                 {
-
                     extension = FileExtension.VALIDFILE;
                 }
                 return extension;
@@ -931,18 +926,17 @@ namespace PDF_Master.ViewModels.Tools
         {
             return true;
         }
-       
+
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             IsImgEdit = false;
             IsTextEdit = false;
             PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
             PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
-             PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
+            PDFViewer.CustomNotifyHandler -= PDFViewer_CustomNotifyHandler;
             PDFViewer.PDFEditHandler -= PDFViewer_PDFEditHandler;
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
             ShowPropertyPanel(false);
         }
-
     }
-}
+}

+ 116 - 63
PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml

@@ -1,5 +1,6 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:cus="clr-namespace:PDF_Master.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -7,97 +8,149 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:pageeditdialogs="clr-namespace:PDF_Master.ViewModels.Dialog.PageEditDialogs"
     xmlns:prism="http://prismlibrary.com/"
-        Background="Transparent" Width="374"
-                Height="120" d:DesignHeight="120"
+    Width="374"
+    Height="120"
+    d:DesignHeight="120"
     d:DesignWidth="374"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
-             Loaded="UserControl_Loaded"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="Transparent"
+    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <Grid>
         <Border
-              Name="ProgressVisible"  Panel.ZIndex="1" Background="Transparent" Visibility="Visible">
-            <Border 
+            Name="ProgressVisible"
+            Panel.ZIndex="1"
+            Background="Transparent"
+            Visibility="Visible">
+            <Border
                 Width="374"
                 Height="120"
                 Background="#FFFFFF"
                 BorderBrush="Gray"
                 BorderThickness="1"
-                CornerRadius="4"
-                >
+                CornerRadius="4">
                 <Grid>
-                    <Grid Margin="16,18,16,0" 
-                Height="54" Background="Transparent" VerticalAlignment="Top">
+                    <Grid
+                        Height="54"
+                        Margin="16,18,16,0"
+                        VerticalAlignment="Top"
+                        Background="Transparent">
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Name="ProgressBarName" Foreground="#000000" Text="{Binding T_ProgressBarName}" />
                             <TextBlock
-                            Margin="16,0,0,0"
-                            Text="("
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Name="ProgressBarName"
+                                Foreground="#000000"
+                                Text="{Binding T_ProgressBarName}" />
+                            <TextBlock
+                                Margin="16,0,0,0"
+                                Foreground="#000000"
+                                Text="("
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarCurrentSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarCurrentSizeValue}" />
+                                Name="ProgressBarCurrentSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarCurrentSizeValue}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text="/"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text="/"
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarFileSize}"/>
+                                Name="ProgressBarSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarFileSize}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text=")"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text=")"
+                                Visibility="Visible" />
                         </StackPanel>
                         <Button
-                        Width="12"
-                        Height="12"
-                        Padding="0,0,1,1"
-                        Margin="0,0,0,0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Top"
-                        BorderThickness="0"
-                        Background="Transparent"
-                        Command="{Binding CancelCommand}"
-                        Visibility="Collapsed">
+                            Width="12"
+                            Height="12"
+                            Margin="0,0,0,0"
+                            Padding="0,0,1,1"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Top"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Command="{Binding CancelCommand}"
+                            Visibility="Collapsed">
                             <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4" />
                         </Button>
-                        <StackPanel Orientation="Horizontal" 
-                        Margin="0,0,0,0"
-                        VerticalAlignment="Bottom" Background="Transparent">
+                        <StackPanel
+                            Margin="0,0,0,0"
+                            VerticalAlignment="Bottom"
+                            Background="Transparent"
+                            Orientation="Horizontal">
                             <ProgressBar
-                        Margin="0,0,18,0"
-                        Name="ProgressBar"
-                        Height="5"
-                        Width="280"
-                        BorderThickness="0"
-                        Foreground="Green"
-                        Maximum="100"
-                        Value="{Binding ProgressBarCurrentValue}" />
+                                Name="ProgressBar"
+                                Width="280"
+                                Height="5"
+                                Margin="0,0,18,0"
+                                BorderThickness="0"
+                                Foreground="Green"
+                                Maximum="100"
+                                Value="{Binding ProgressBarCurrentValue}" />
                             <TextBlock
-                            FontSize="12"
-                            Foreground="#666666"
-                            Text="{Binding ElementName=ProgressBar,Path=Value, StringFormat={}{0}%}"
-                             />
+                                FontSize="12"
+                                Foreground="#666666"
+                                Text="{Binding ElementName=ProgressBar, Path=Value, StringFormat={}{0}%}" />
                         </StackPanel>
-
                     </Grid>
-                    <StackPanel Name="errorStackPanel" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="{Binding ErrorStackPanelVisible}"  Margin="16,18">
-                        <Grid Width="14" Height="14" Margin="4,0,8,0" VerticalAlignment="Center">
-                            <Ellipse Width="12" Height="12" Fill="#F3465B"></Ellipse>
-                            <Path  Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z" Fill="white" Margin="-1,-1,1,1" />
+                    <StackPanel
+                        Name="errorStackPanel"
+                        Margin="16,18"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="{Binding ErrorStackPanelVisible}">
+                        <Grid
+                            Width="14"
+                            Height="14"
+                            Margin="4,0,8,0"
+                            VerticalAlignment="Center">
+                            <Ellipse
+                                Width="12"
+                                Height="12"
+                                Fill="#F3465B" />
+                            <Path
+                                Margin="-1,-1,1,1"
+                                Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z"
+                                Fill="white" />
                         </Grid>
-                        <TextBlock Name="ErrorTextBlock" Text="{Binding T_ErrorTextBlock}" Foreground="#F3465B"  FontSize="11" VerticalAlignment="Center"></TextBlock>
+                        <TextBlock
+                            Name="ErrorTextBlock"
+                            VerticalAlignment="Center"
+                            FontSize="11"
+                            Foreground="#F3465B"
+                            Text="{Binding T_ErrorTextBlock}" />
                     </StackPanel>
-                    <StackPanel  Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Visible" HorizontalAlignment="Right" Margin="16,13">
-                        <Button Name="tryAgainBtn" Width="60" Height="24" Margin="0,0,8,0" Content="{Binding T_TryAgainBtn}"  Style="{StaticResource Btn.cta}"  Command="{Binding TryAgainCommnad}"   Visibility="{Binding TryAgainBtnVisible}"></Button>
-                        <Button Name="CancelBtn" Width="60" Height="24" Content="{Binding T_CancelBtn}" Style="{StaticResource btn.sec}"  Command="{Binding CancelCommand}"  BorderThickness="1" ></Button>
+                    <StackPanel
+                        Margin="16,13"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="Visible">
+                        <Button
+                            Name="tryAgainBtn"
+                            Width="80"
+                            Height="30"
+                            Margin="0,0,8,0"
+                            Command="{Binding TryAgainCommnad}"
+                            Content="{Binding T_TryAgainBtn}"
+                            Style="{StaticResource Btn.cta}"
+                            Visibility="{Binding TryAgainBtnVisible}" />
+                        <Button
+                            Name="CancelBtn"
+                            Width="60"
+                            Height="24"
+                            BorderThickness="1"
+                            Command="{Binding CancelCommand}"
+                            Content="{Binding T_CancelBtn}"
+                            Style="{StaticResource btn.sec}" />
                     </StackPanel>
                 </Grid>
             </Border>
         </Border>
     </Grid>
-</UserControl>
+</UserControl>

+ 1 - 1
PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml

@@ -77,7 +77,7 @@
                                 Name="SampleText"
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center"
-                                FontFamily="{Binding CurrentFontFamily.ValueStr}"
+                                FontFamily="{Binding CurrentFontFamily.Content}"
                                 FontSize="{Binding CurrentFontSize.Value}"
                                 FontStyle="{Binding FontStyleItem}"
                                 FontWeight="{Binding FontWeightItem}"

+ 7 - 3
PDF Office/Views/Tools/TextEditToolContent.xaml

@@ -7,7 +7,9 @@
     xmlns:local="clr-namespace:PDF_Master.Views.Tools"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodels="clr-namespace:PDF_Master.ViewModels.Tools"
     Height="40"
+    d:DataContext="{d:DesignInstance Type=viewmodels:TextEditToolContentViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -15,7 +17,7 @@
     <Grid>
         <Border BorderBrush="{StaticResource color.sys.layout.divider}" BorderThickness="0,1,0,1">
             <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
-                <customControl:CustomIconToggleBtn IsChecked="{Binding IsTextEdit}"
+                <customControl:CustomIconToggleBtn
                     x:Name="BtnAddText"
                     Height="28"
                     Padding="4,0"
@@ -23,6 +25,7 @@
                     CommandParameter="{Binding ElementName=BtnAddText}"
                     ContentStringFormat="156"
                     Foreground="Black"
+                    IsChecked="{Binding IsTextEdit}"
                     Style="{StaticResource SubToolbarTgb}"
                     Tag="Text">
                     <StackPanel Orientation="Horizontal">
@@ -40,7 +43,7 @@
                             Text="Add Text" />
                     </StackPanel>
                 </customControl:CustomIconToggleBtn>
-                <customControl:CustomIconToggleBtn IsChecked="{Binding IsImgEdit}"
+                <customControl:CustomIconToggleBtn
                     x:Name="BtnAddImage"
                     Height="28"
                     Margin="8,0"
@@ -49,6 +52,7 @@
                     CommandParameter="{Binding ElementName=BtnAddImage}"
                     ContentStringFormat="156"
                     Foreground="{StaticResource color.icon.base.brand}"
+                    IsChecked="{Binding IsImgEdit}"
                     Style="{StaticResource SubToolbarTgb}"
                     Tag="Image">
                     <StackPanel Orientation="Horizontal">
@@ -58,9 +62,9 @@
                         </Grid>
                         <TextBlock
                             Margin="4,0,0,0"
+                            VerticalAlignment="Center"
                             FontFamily="Segoe UI"
                             FontSize="12"
-                            VerticalAlignment="Center"
                             Text="Add Image" />
                     </StackPanel>
                 </customControl:CustomIconToggleBtn>

+ 17 - 14
UpdateXML/pdfmaster_win_en_Us.xml

@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <channel>
-    <title>PDF Master's Changelog</title>
-    <link> https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml</link>
-    <description>Most recent changes with links to updates.</description>
-    <language>en</language>
-      <item>
-        <title>Version 1.2.0</title>
-        <description>
-            <![CDATA[
+	<channel>
+		<title>PDF Master's Changelog</title>
+		<link> https://www.pdfreaderpro.com/downloads/pdfmaster_win_en_Us.xml</link>
+		<description>Most recent changes with links to updates.</description>
+		<language>en</language>
+		<item>
+			<title>Version 1.2.0</title>
+			<description>
+				<![CDATA[
           <ul>
             <head>PDF Master New Release: Edit PDF page for a more organized document!</head>
             <br></br>
@@ -19,9 +19,12 @@
             <head>We are constantly improving our software, if you have any questions or feedback, feel free to contact us at support@pdfreaderpro.com</head>
             </ul>
             ]]>
-        </description>
-       <pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
-        <enclosure url="https://www.pdfreaderpro.com/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
-      </item>
-  </channel>
+			</description>
+			<pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
+			<enclosure url="https://www.pdfreaderpro.com/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
+			<ocrenclosure>
+				<ocrenclosure0 ocrurl="http://test-pdf-pro.kdan.cn:3021/downloads/OCREngine.zip" ocrmd5="65d21a699138c194f06a8640dd40a901" sparkle:startversion="1.3.0" sparkle:endversion="1.4.0" />
+			</ocrenclosure>
+		</item>
+	</channel>
 </rss>

+ 17 - 14
UpdateXML/pdfmaster_win_zh_Hans.xml

@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <channel>
-    <title>PDF Reader Pro's Changelog</title>
-    <link> https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win.xml</link>
-    <description>Most recent changes with links to updates.</description>
-    <language>en</language>
-           <item>
-        <title>Version 1.2.0.0</title>
-        <description>
-            <![CDATA[
+	<channel>
+		<title>PDF Reader Pro's Changelog</title>
+		<link> https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win.xml</link>
+		<description>Most recent changes with links to updates.</description>
+		<language>en</language>
+		<item>
+			<title>Version 1.2.0.0</title>
+			<description>
+				<![CDATA[
            <ul>
             <head>PDF Reader Pro 新版本发布!利用升级的转档工具快速将PDF转换成Office文档!</head>
             <br></br>
@@ -18,9 +18,12 @@
             <head>有任何反馈,意见或是建议,请随时与我们联系:support@pdfreaderpro.com</head>
             </ul>
             ]]>
-        </description>
-       <pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
-     <enclosure url="http://test-pdf-pro.kdan.cn:3021/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
-      </item>
-  </channel>
+			</description>
+			<pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
+			<enclosure url="http://test-pdf-pro.kdan.cn:3021/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
+			<ocrenclosure>
+				<ocrenclosure0 ocrurl="http://test-pdf-pro.kdan.cn:3021/downloads/OCREngine.zip" ocrmd5="65d21a699138c194f06a8640dd40a901" sparkle:startversion="1.3.0" sparkle:endversion="1.4.0" />
+			</ocrenclosure>
+		</item>
+	</channel>
 </rss>

+ 17 - 14
UpdateXML/pdfmaster_win_zh_Hant.xml

@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
-  <channel>
-    <title>PDF Reader Pro's Changelog</title>
-    <link> https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win.xml</link>
-    <description>Most recent changes with links to updates.</description>
-    <language>en</language>
-          <item>
-        <title>Version 1.2.0.0</title>
-        <description>
-            <![CDATA[
+	<channel>
+		<title>PDF Reader Pro's Changelog</title>
+		<link> https://www.pdfreaderpro.com/downloads/pdfreaderprocast_win.xml</link>
+		<description>Most recent changes with links to updates.</description>
+		<language>en</language>
+		<item>
+			<title>Version 1.2.0.0</title>
+			<description>
+				<![CDATA[
            <ul>
             <head>PDF Reader Pro新版發佈!利用升級的轉檔工具快速將PDF轉換成Office文檔!</head>
             <br></br>
@@ -18,9 +18,12 @@
             <head>有任何反饋,意見或是建議,請隨時與我們聯繫:support@pdfreaderpro.com</head>
             </ul>
             ]]>
-        </description>
-       <pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
-     <enclosure url="http://test-pdf-pro.kdan.cn:3021/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
-      </item>
-  </channel>
+			</description>
+			<pubDate>Thur, 20 Dec 2022 00:00:00 +0000</pubDate>
+			<enclosure url="http://test-pdf-pro.kdan.cn:3021/downloads/PDFMaster.exe" sparkle:version="1.2.0.0" />
+			<ocrenclosure>
+				<ocrenclosure0 ocrurl="http://test-pdf-pro.kdan.cn:3021/downloads/OCREngine.zip" ocrmd5="65d21a699138c194f06a8640dd40a901" sparkle:startversion="1.3.0" sparkle:endversion="1.4.0" />
+			</ocrenclosure>
+		</item>
+	</channel>
 </rss>